Number of arrangements for a varying number of Balls in N colors

Let $N\in\mathbb{N}$ be a number of colors. For each of these colors let $a_k$ be the number of indistinguishable Balls in the specific color. How many arrangements of balls can I find, when I am using all Balls given ($\sum_{k=1}^N a_k$)?

E.g.: Take 2 red balls $R$ and one green ball $G$. We can find the arrangements: $RRG$, $GRR$, $RGR$ so we got 3 arrangements.

A friend suggested the following solution: Take one color and consider all the other balls as balls of the same color. Solve this 2 color problem and then look at the $N-1$ remaining colors and do the same. All those combinatons will add up multiplicatively. However he wasn't sure if this approach is correct.

Is my friend's solution correct? And if it is, can the two color problem be calculated by the "twelvefold way"? Or is there a smarter solution?

$$\frac{T!}{\prod\limits_{k=1}^Na_k!}$$
$T!$ is the number of ways to arrange the balls if they were distinguishable. But for each color, this total counts $a_k!$ too many times (e.g. it would count RGGG 6 times when you only want to count 1 because the total includes all permutations of GGG). So we divide the total by $a_k!$ for each color.