Selecting identical and distinguishable balls when the order matters I made up a question such that

There are $3$ identical blue balls ,$2$ identical red balls , $5$ distinguishable yellow balls ,$4$ distinguishable green balls. We want to make a mixture consisting of $8$ balls by using these balls. How many ways are there
a-) If selection order does not matter
b-) If selection order matters

MY WORK =
a-) This part was easy by using generating functions such that
Blue balls = $(1+x +x^2 +x^3 ) $
Red balls =  $(1+x +x^2 )$
Yellow balls = $(1+5x +10x^2 +10x^3 +5x^4 +x^5) $
Green balls = $(1+4x +6x^2 +4x^3 +x^4)$
We should find the coefficient of $[x^{8}]$ in the expansion of them .
b-) This part is where i hesitated my solution. I used exponential generating functions , but i am not sure about the exponential generating function of distinguishable balls.
Blue balls = $$\bigg(1+ \frac{x}{1!} +\frac{x^2}{2!} + \frac{x^3}{3!} \bigg ) $$
Red balls = $$\bigg(1+ \frac{x}{1!} +\frac{x^2}{2!} \bigg)$$
Yellow balls = $$ \bigg (1 + \frac{P(5,1) \times x}{1!} +\frac{P(5,2) \times x^2}{2!} + \frac{P(5,3) \times x^3}{3!} + \frac{P(5,4) \times x^4}{4!} + \frac{P(5,5) \times x^5}{5!} \bigg)$$
Green balls = $$ \bigg (1 + \frac{P(4,1) \times x}{1!} +\frac{P(4,2) \times x^2}{2!} + \frac{P(4,3) \times x^3}{3!} + \frac{P(4,4) \times x^4}{4!} \bigg)$$
So , i should find the coefficient of $\frac{x^{8}}{8!}$ or find the coefficient of $x^{8}$ and multiply it by $8!$.
I am not sure about part $b$ .I want you to check my solution.
 A: Your work is all correct.
Here is a way to simplify your work. Give each of the yellow and green balls its own generating functions, since $5$ distinguishable yellow balls is the same as 5 different colors each with one ball.  The g.f. for each of these colors with a single ball is $1+x$, for both the  ordered and unordered cases. Therefore, the unordered case is
$$
[x^8](1+x+x^2+x^3)(1+x+x^2)(1+x)^{5+4}
$$
and the ordered case is
$$
8!\cdot [x^8](1+x+x^2/2!+x^3/3!)(1+x+x^2/2!)(1+x)^{5+4}
$$
A: I believe you have arrived at the correct answer, though I wouldn't do it the way you did.
There are $9$ distinguishable balls;  it doesn't matter if they're green or yellow.  Suppose we pick $r$ red balls, $b$ blue balls and $k$ green/yellow balls.  We can arrange these in $$\frac{12!}{r!b!}\tag1$$ ways.
So, it seems to me that an ordinary generating function is more appropriate for the green/yellow balls.  I would use $$\sum_{k=0}^9\binom9kx^k$$  I think your expression comes to the same thing, but it's harder to understand. I don't think you would have had the doubts that led you to post this question if you'd done the problem the way I suggest.
Finally, you should find the coefficient of $x^{8}$ and multiply by $12!$.  The expression in $(1)$ makes this clear.
