Binomial distribution with random parameter I want to compute the probabbilty 
$$
P(S = k) = \sum_{l = 0}^n P(S=k|N=l)P(N=l)
$$
where $N$ is a binomial random variable $B(n, p)$. And when $N = l$, $S$ is also a binomial $B(l, r)$. I tried to compute but it seems difficult, thank you for any anwser or suggestion.

You can think of $S$ this way. There are $n$ potential coins. For each of them, we have a Bernoulli random variable $Y_i$ which equals 1 with probability $r$. Then we choose which of the coins we use, choosing each of them with probability $p$. We sum $Y_i$ over the remaining coins. We can set $X_i$ to be 1 if the $i$th coin was chosen, and then
$$
S = \sum_{i=1}^n X_i Y_i.
$$
Now $X_i Y_i$ is also a Bernoulli random variable, which equals 1 with probability $pr$. Hence $S \sim B(n,pr)$.
