Number of arrangements of red, blue, and green balls in which a maximum of three balls of the same color are placed in the five slots 
From the picture above I have five slots and a bag of balls (three) of color -red, blue and green...
Question
Now whenever I choose a ball, I note the colour and replace it in the bag, then I randomly keep choosing balls (independent event) until all five slots are filled and put them back in the bag..
How can I derive a formula to find all possible repetitive arrangements (exhaustive approach) with the condition that a MAXIMUM of THREE balls of the same color are in the five slots.
Note:
I have ask a similar question at Finding the Total number of permutation using a selective formula
In the accepted answer, there were five slots and five letters and all arrangements with a maximum of three letters were found using a pattern
$3-1-1: \binom5{1,2,2}\binom5{3,1,1}$
$2-2-1: \binom5{2,1,2}\binom5{2,2,1}$
$2-1-1-1: \binom5{1,3,1}\binom5{2,1,1,1}$
$1-1-1-1-1:\binom55\binom5{1,1,1,1,1}$ 
Now in this question the number of balls and slots varies
I would like to build from the pattern above answer using multinomials (since I don't want to write a  new algorithm again)

We will solve the problem:  "how many words of length $5$ on $\{R,B,G\}$ are there in which no letter appears more than $3$ times".
Easier to work backwards.  Without the cap rule there are $3^5$ possible words.  
How many of these have exactly $4\;R's$?  Well there are $5$ place to put the non-$R$, and $2$ options for what letter it is.  Hence $10$.  As there are three letter, there are exactly $30$ words of length $5$ in which some letter appears exactly $4$ times.  
Now, of course there are eactly $3$ words in which a letter appears $5$ times.  
Hence there are $30+3=33$ words of length $5$ in which some letter appears more than $3$ times.  
It follows that there are $3^5-33=\fbox {210}$ words of length $5$ in which no letter appears more than $3$ times.
