Error solving "stars and bars" type problem I have what I thought is a fairly simple problem: Count non-negative integer solutions to the equation
$$x_1 + x_2 + x_3 + x_4 + x_5 = 23$$
such that $0 \leq x_1 \leq 9$.
Not too hard, right? Simply ignore the upper-bound, count the
$$\begin{pmatrix}23 + (5-1) \\ (5-1)\end{pmatrix} = \begin{pmatrix}27 \\ 4\end{pmatrix} = 17550$$ solutions. Subtract from this all (non-negative integer) solutions to the equation
$$y_1 + 10 + x_2 + x_3 + x_4 + x_5 = 23,$$
and there are $\begin{pmatrix}17 \\ 4\end{pmatrix} = 2380$ of these "bad" solutions we shouldn't have counted earlier, but did. Thus we find $17550 - 2380 = 15170$ solutions.
Since this is a prohibitively large number of solutions to check by hand, I wrote a simple Python program to verify whether this answer is correct. It does indeed say there are $17550$ solutions without upper bounds, and $2380$ solutions to the equation for counting "bad" solutions.
However, when I ask it throw away all solutions to the non-upper-bounded problem for which $x_1 \geq 10$, it tells me it's found $15730$ solutions.
My question is: do I not understand the combinatorial calculation so that there are not actually $\begin{pmatrix}27\\4\end{pmatrix}-\begin{pmatrix}17\\4\end{pmatrix}$ solutions, or have I made some kind of programming mistake? Of course, both are also possible.

$\displaystyle S=\sum_{x_1=0}^9 \{x_2+x_3+x_4+x_5=23-x_1\}=\sum_{x_1=0}^9 {26-x_1\choose 3}=\sum_{x_1=0}^9 {17+x_1\choose 3}$
$\displaystyle\quad= \sum_{x_1=0}^9 \left[{18+x_1\choose 4}-{17+x_1\choose 4}\right]={27\choose 4}-{17\choose 4}$
