There are five counties in California: San Mateo, San Francisco, Alameda, Marin, and Napa which are to receive 173 million in relief funding (in integer multiples of millions of dollars). In how many ways can this distribution be made, assuming that each county receives at least $1 million, San Mateo county receives at most 10 million, and San Francisco county receives at most 30 million.
Here's my thought process, use principle of inclusion-exclusion on the complement. In order to compute the complement we find the # of ways that either San Mateo county receives more than 10 million or SF receives more than 30 million. We can compute each individually and then subtract when both occur to account for double counting (both San Mateo and SF receive more than their restricted amount).
Since we are computing the complement we are subtracting from the total number, this problem boils down to: $a_1+a_2+a_3+a_4+a_5 = 168$. For the basic restriction of 1 million preallocated to each county. This means the total number of ways is $\binom{172}{4}$ by stars and bars.
Now lets compute when San Mateo receives more than 10 million: We preallocate 1 to each $a_1,a_2,a_3,a_4$ and $10$ to $a_5$ so we get: $b_1+b_2+b_3+b_4+b_5 = 159$ so $\binom{163}{4}$
Now lets compute when San Fran receives more than 30 million: We preallocate 1 to each $a_1,a_2,a_3,a_5$ and $30$ to $a_4$ so we get: $b_1+b_2+b_3+b_4+b_5 = 139$ so $\binom{143}{4}$
Now lets compute when San Mateo receives more than 10 million and SF more than 30 million: We preallocate 1 to each $a_1,a_2,a_3$ and $30$ to $a_4$ and $10$ to $a_5$ so we get: $b_1+b_2+b_3+b_4+b_5 = 130$ so $\binom{134}{4}$
This means by inclusion-exclusion principle we have $$\binom{172}{4} - (\binom{163}{4}+\binom{143}{4} - \binom{134}{4})$$ $\blacksquare$
Is my work correct?