There are $5$ red balls, $4$ green balls and $3$ yellow balls in a bag. One ball is retrieved a time until all the balls are taken out. What is the probability that all the red balls are retrieved before all the green or yellow balls are retrieved?
Similar to # 4266, we can model this solution using the following grid system.
Each way of retrieving all the balls is corresponding to one shortest path from point $A$ to point $B$. When all the red balls are retrieved first, such route must hit the grey surface before reaching point $B$. There are three points connecting to $B$. However, only $C_3$ and $D_2$ on the qualified routes. That being said, not all the routes lead to point $C_3$ and $D$ are qualified routes because they can come from the top or the back surface. We need to count only qualified routes.
We will analyze the route $C$ first.
Consider point $C_0$. There are totally $C_{5+3}^5$ routes from $A$ to $C_0$. Among these, qualified routes must go through the bottom edge of the grey surface whose counts is $C_{5+3-1}^5$. The rest are unqualified which come from the bottom edge of the back surface whose count is $C_{5+3-1}^3$. Let their ratio be $k$, then $$k_c =C_{5+3-1}^5 : C_{5+3-1}^3= 3:5$$
Note that $k$ is the reverse ratio of the number of balls with corresponding colors.
Now, consider point $C_1$. There are three routes which lead to it: one is from below (i.e. $C_0$), another is from parrall point on the gray surface and the last one is from the back surface. Let's calculate the ratio of the last two routes. By the conclusion of # 4264, the result is: $$\frac{(5+(3-1)+1)!}{5!\cdot 2!\cdot 1!} : \frac{((5-1)+3+1)!}{4!\cdot 3!\cdot 1!} = 3:5 =k_c$$
We already know the ratio of qualified and unqualified routes leading to point $C_0$ is $k$. Hence, we conclude that the ratio between qualified routes and unqualified routes leading to $C_1$ is $k_c$. Repeating the same process, we can conclude this ratio still holds for the routes leading to point $C_3$. Let the number of qualified routes leading to point $R_c$ be $C_q$ and the number of routes leading to point $C_3$ be $C_3$, we have $$\begin{array}{rl}&R_c=\frac{(5+3 + (4-1))!}{5!\cdot 3! \cdot (4-1)!}\\ \implies& C_q = C_3 \times \frac{k_c}{1+k_c} = \frac{(5+3 + (4-1))!}{5!\cdot 3! \cdot (4-1)!}\times \frac{3}{5+3}\end{array}$$
Similarly, we can find the number of qualified routes leading to point $D_2$ is $$R_d=\frac{(5+(3-1) + 4)!}{5!\cdot (3-1)! \cdot 4!}\times \frac{4}{5+4}$$
The total number of routes leading to point $B$ is $$R_b = \frac{(5+4+3)!}{5!\cdot 4! \cdot 3!}$$
Therefore, the desired answer is $$\frac{R_c+R_d}{Rb}=\frac{4\times 3}{5+4+3}\times\left(\frac{1}{5+3} + \frac{1}{5+4}\right)=\boxed{\frac{17}{72}}$$
In general, if there are $R$ red balls, $G$ green balls, and $Y$ yellow balls, the probability of retrieving all the red balls first is $$\frac{G\cdot Y}{R+G+Y}\times\left(\frac{1}{R+G}+\frac{1}{R+Y}\right)$$