Unfair coins connected in a game I would like to ask the following question.

There are 3 coins ($A,B$ and $C$) that are biased with probability of tails equal to $t_a, t_b$ and $t_c$ respectively.   The coins are tossed: $m_a$ times for coin-$A$, $m_b$ times for coin-$B$, and $m_c$ times for coin-$C$, though with no specific order (the order is uniformly random).   There are $k$ slots that are filled with the coins when tails is a result.   When all $k$ slots are filled the game stops.
What is the function / expression that I should use to find the probability that $s_a$ slots from coin A, $s_b$ slots from coin B and $s_c$ slots from coin C are filled with $s_a + s_b + s_c \leqslant k$?

 A: So clearly if we removed the rule that we stop after $k$ tails, the formula would simply be $$P_m(s_a,s_b,s_c)=\prod_{i \in \{a,b,c\}}t_i^{s_i}(1-t_i)^{m_i-s_i}{m_i \choose s_i}$$
In cases where $s_a+s_b+s_c\lt k$, the rule never applies, and the above formula is correct. $$ P(s_a,s_b,s_c)= P_m(s_a,s_b,s_c); \quad s_a+s_b+s_c\lt k$$
In cases where $s_a+s_b+s_c= k$, we consider what would happen if we kept going until we had flipped each coin the prescribed number of times, possibly accumulating additional tails.
For any given $z_a,z_b,z_c$ and $s_a,s_b,s_c$ where $z_i \ge s_i$ and $\sum _{i}s_i=k$ for $i\in \{a,b,c\}$, the probability of flipping $z_i$ tails on coin $i$ with $s_i$ of those coming in the first $k$ tails is $$\Phi(z_a,z_b,z_c,s_a,s_b,s_c)=\frac{{z_a \choose s_a} {z_b \choose s_b}{z_c \choose s_c}}{z_a+z_b+z_c \choose k} P_m(z_a,z_b,z_c)$$
so the total probability for $s_a+s_b+s_c= k$ is
$$ P(s_a,s_b,s_c)=\sum_{z_a=s_a}^{m_a} \sum_{z_b=s_b}^{m_b}\sum_{z_c=s_c}^{m_c}\Phi(z_a,z_b,z_c,s_a,s_b,s_c); \quad s_a+s_b+s_c= k$$
Not the prettiest formula, nor the easiest to calculate, but it is correct.
