Recently I was stumped by the calculation of the probability $$\mathbb{P} \big(\sum_{i=1}^{m} (A_i + S_i) \le L < \sum_{i=1}^{m+1} (A_i + S_i) \big)$$ where $A_i \sim \text{exp}(\lambda), S_i \sim \text{exp}(\mu), L \sim \text{exp}(\lambda)$ are mutually independent, $\lambda \neq \mu$ are two positive integers, and $m$ is an integer parameter.

**My attempt:**

I failed at the very start while calculating the density function of $\sum_{i=1}^{m} (A_i + S_i)$: $$\sum_{i=1}^{m} (A_i + S_i) = \sum_{i=1}^{m}{A_i} + \sum_{i=1}^{m}{S_i} = \big( A \sim \Gamma(m, \lambda) \big) + \big( S \sim \Gamma(m, \mu) \big)$$ Considering the two Gamma random variable $A$ and $S$, their convolution is: $$p_{A+S}(a) = p_{A} \ast p_{S} (a) = \int_{0}^{a} f_{A}(a-y) f_{S}(y) dy \\ = \int_{0}^{a} \frac{\lambda e^{-\lambda (a-y)} (\lambda (a-y))^{m-1}}{\Gamma(m)} \frac{\mu e^{-\mu y} (\mu y)^{m-1}}{\Gamma(m)} dy \\ = e^{-\lambda a} \frac{\lambda^m \mu^m}{\Gamma(m) \Gamma(m)} \int_{0}^{a} e^{(\lambda - \mu) y} \large((a-y)y \large)^{m-1} dy$$

**And my failure:**

I was not able to go any further with the integral. And you can image what a messy calculation we will run into when we are going to take the second step involving $\sum_{i=1}^{m} (A_i + S_i) \le L$.

**My questions:**

Generally, my question is how to make the calculation tractable.

Specifically,

Has the probability been studied in research papers?

People interested in its background in "alternating renewal process" are referred to the following part of the post.What is the density function of $\big( A \sim \Gamma(m, \lambda) \big) + \big( S \sim \Gamma(m, \mu) \big)$ given that $m$ is an integer and $\lambda \neq \mu$ are positive integers?

If there is no nice closed form, can we make some good approximation?

Related post: at Math.SE (without proper answers yet).For the whole calculation, is it feasible to obtain numerical solution using mathematical softwares?

Are there any off-the-shelf libraries for this purpose?

**For people who want to know the background of the probability in "alternating renewal process":**

Background:Consider an alternating renewal process, in which a system can be in one of two states: on or off. Whenever it is off, it takes a time $A_i \sim \text{exp}(\lambda)$ before turning on. Whenever it becomes on, it remains on for a time $S_i \sim \text{exp}(\mu)$. Initially the system is off. A cycle $c_i$ consists of the $i$th off-state and the $i$th on-state. All $A_i$ and $S_i$ are mutually independent and $\lambda \neq \mu$ are two positive integers.

Problem:Given a time period $L \sim \text{exp}(\lambda)$, what is the probability that exactly $m$ cycles occur in $L$?

Related post: at MO: its origin; many thanks to @user137846.