How many solutions are there to the equation
u + v + w + x + y + z = 18
where u, v, w, x, y, and z are nonnegative integers, and x is at most 10?
Case 1: x = 10
u + v + w + y + z = 8, stars and bars means (8 + 5 - 1 choose 5 - 1) = 495 ways.
Case 2: x = 9
u + v + w + y + z = 9, stars and bars mean (13 choose 4) = 715 ways.
Case 3: x = 8
Stars and bars means (14 choose 4) = 1001 ways.
...
Case 11: x = 0
(22 choose 4) = 7315 ways.
Add (12 choose 4) + (13 choose 4) + (14 choose 4) + ... + (21 choose 4) + (22 choose 4) is your answer = 32857 total solutions.