We have 3 types of balls (red, yellow and blue), so the number of arranging then is 3!. Now, the balls in each type can also be arranged in their own type.
since the balls are different
P = 3! x 5! x 4! x 3!
= 6 x 120 x 24 x 6
= 103680
Sum of digits of P is 1 + 0 + 3 + 6 + 8 + 0 = 18