One simple way to do this is to write down a recurrence.  Let f (r,b,g,w,prev) denotes number of ways if r red, b blue, g green and w white balls are left and let prev denotes color of last ball. If last ball taken was red, then we have number of ways to arrange as

f (r,b,g,w,red) = f (r,b1,g,w,blue) + f (r,b,g1,w,green) + f(r,b,g,w1,white)

The initial conditions are

f (1,0, 0, r) = f (0,1,0,b) = f (0,0,1,g=1, together with f(0,0,0,c) =0.

We can memoize f to get the result and the answer would be

f (r1,b,g,w,red) + f (r,b1,g,w,blue) + f (r,b,g1,w,green) + f (r,b,g,w1,white)