How many solutions $x_1+\dots+x_8=30$ has? 
Enumerate the solutions of
  $$x_1+\dots+x_8=30$$
  where $2\leq x_i\leq 5$ for $i=1,\dots,6$,
  and $x_7$ and $x_8$ must be or 5 or 10.

I am not sure with my process. 
and I would like to ask you if you have a better way to solve this?
and if I am right.
$S_0 - S_1 + S_2 - S_3\dots$ etc. is the solution. 
but i think im doing something wrong:
my solution
 A: A possible way is using generating functions:


*

*First set $y_i = x_i-2$ for $i=1,\ldots , 6$ and $y_i = x_i -5$ for $i=7,8$. So, you look for the number of solutions of 
$$\mbox{}y_1 + \cdots + y_6 + y_7 + y_8 = 8 \mbox{ with } 0\leq y_i \leq 3 \;(i=1,\ldots ,6) \mbox{ and } y_i \in \{0,5\}\;(i=7,8)$$

*So you look for the coefficient of $x^8$ of the generating function of this problem (look at the exponents): $$(1+x+x^2+x^3)^6(1+x^5)^2 = \left(\frac{1-x^4}{1-x}\right)^6(1+x^5)^2$$

*Using $\frac{1}{(1-x)^6} = \sum_{n=0}^{\infty}\binom{n+5}{5}x^n$ (which can easily be verified by repeated differentiation), you get
\begin{eqnarray*} [x^8]\left(\frac{1-x^4}{1-x}\right)^6(1+x^5)^2
& = & [x^8](1-6x^4+\binom{6}{2}x^8)(1+2x^5)\sum_{n=0}^{\infty}\binom{n+5}{5}x^n \\
& = & [x^8](1-6x^4+2x^5 + \binom{6}{2}x^8)\sum_{n=0}^{\infty}\binom{n+5}{5}x^n \\
& = & \binom{8+5}{5} - 6\binom{4+5}{5} + 2\binom{3+5}{5} + \binom{6}{2}\\
& = & \boxed{658}
\end{eqnarray*}
A: I will try to follow the approach given in your solution in a correct way.
Let $y_i=x_i-2$ for $i=1,\dots,6$ with $0\leq y_i\leq 3$. We consider three cases. 
i) If $x_7=x_8=5$ then the equation $x_1+\dots+x_8=30$ can be written as
$$y_1+y_2+y_3+y_4+y_5+y_6=30-x_7-x_8-2\cdot 6=8.$$
ii) If $x_7=5,x_8=10$ or $x_7=10,x_8=5$ then the equation $x_1+\dots+x_8=30$ can be written as
$$y_1+y_2+y_3+y_4+y_5+y_6=30-x_7-x_8-2\cdot 6=3.$$
iii) If $x_7=x_8=10$ then the equation $x_1+\dots+x_8=30$ can be written as
$$y_1+y_2+y_3+y_4+y_5+y_6=30-x_7-x_8-2\cdot 6=-2.$$
In each case we use the Inclusion-Exclusion Principle and we apply Stars-and-Bars.
For i), let $S_k$ be the number of solutions with at least $k$ terms $y_i\geq 4$, then 
$$\begin{align}
n_1&=S_0-S_1+S_2= \binom{8+5}{5}-6\binom{(8-4)+5}{5}+\binom{6}{2}\binom{(8-4-4)+5}{5}\\
&=1287-6\cdot126 +15 \cdot 1=546.
\end{align}$$
For ii),
$$n_2=2\cdot S_0= 2\cdot\binom{3+5}{5}=2\cdot 56=112.$$
The last case iii) is trivial and we have $n_3=0$.
Hence the final result is 
$$n_1+n_2+n_3=546+112+0=\boxed{658}.$$
