Let $T_1, T_2, \ldots, T_n$ be $n$ iid. exponential variables with common mean $a$. After a period of time $T_1$ has elapsed a biassed coin, with heads probability $p$, is tossed. If a tail appears the coin is tossed again after a period $T_2$ has elapsed, and so on until a head appears.
What is the distribution of the time until the first head appears?
The time it takes for the first head to appear is a random variable equal to:
$$Y = \begin{cases} T_1 & \text{with probability $p$} \\ T_1 + T_2 & \text{with probability $(1-p)p$}\\\ \dots \\ \sum_{i=1}^n T_i & \text{with probability $(1-p)^{n-1}p$}\\ \dots \end{cases}$$
With this in mind, how can we compute $P(Y \le y)$? There are several possibilities for this event to happen:
and so on. Note that these events are disjoint (the coin toss do not match) so this means that
$$P(Y \le y) = \sum_{i=1}^\infty P\left(\sum_{k=1}^iT_k \le y, \{\text{first $i-1$ coin toss are tail, the $i$-th one is head}\} \right) $$
Now, the coin toss are independent on the exponential random variables, and the sum of independent exponential random variables with parameter $\alpha$ is a gamma with parameter $n$ and $\alpha$, i.e. $\sum_{i=1}^n T_i \sim \Gamma(n, \alpha)$. Call $F_{n, \alpha}$ the cdf of a $\Gamma(n, \alpha)$ distributed random variable. We can therefore write
$$P\left(\sum_{k=1}^iT_k \le y, \{\text{first $i-1$ coin toss are tail, the $i$-th one is head}\} \right) = F_{i, \alpha}(y)(1-p)^{i-1}p$$
Substituting in we get $$P(Y \le y) = p\sum_{i=1}^\infty F_{i, \alpha}(y)(1-p)^{i-1}$$
We know the cdf of the gamma distribution in terms of the lower incomplete gamma function, so that
$$P(Y \le y) = p\sum_{i=1}^\infty \frac {(1-p)^{i-1}}{(i-1)!}\gamma(i, \alpha y)$$
Using the recurrence relation for $\gamma$ ($\gamma(s+1, x) = s\gamma(s,x)-x^se^{-x}$) we could potentially simplify that expression, but it doesn't seem so easy.