# Discrete probability distribution for a multi-stage experiment

Say we choose $n$ experiments to perform (with replacement) from the experiment types $1\dots C$, where an experiment of type $i$ is chosen with probability $q_i$.

Experiments of type $i$ have probability $p_i$ of success.

We are allowed to repeat each experiment up to $m$ times to try and observe a success.

What is the probability of observing $k$ successes in the $n$ experiments?

As a sanity check on the answers, say we choose $n=10$ experiments from two, with $q_1=q_2=0.5$ and their probabilities of success are $p_1=0.9$ and $p_2=0.1$, and we can repeat each experiment up to $m=2$ times.

Then numerical experiments lead me to believe that P(6 successes) $\approx 0.25$.