Long-run average cost per unit time in a renewal process 
A machine consists of two independent components, the $i$th of which functions for an exponential time with rate $\lambda_{i}$. The machine functions as long as at least one of these components function. When a machine fails, a new machine having both components working is put into use. A cost $K$ is incurred whenever a machine failure occurs; operating costs at rate $c_{i}$ per unit time are incurred whenever the machine in use has $i$ working components, $i=1,2$. Find the long-run average cost per unit time. 

The solution has been presented as:
$$     E[C] = K + \frac{c_{2}}{\lambda_{1} + \lambda_{2}} + \frac{c_{1}}{\lambda_{2}}\cdot\frac{\lambda_{1}}{\lambda_{1} + \lambda_{2}} + \frac{c_{1}}{\lambda_{1}}\cdot\frac{\lambda_{2}}{\lambda_{1} + \lambda_{2}}$$
$$ E[T] = \frac{1}{\lambda_{1} + \lambda_{2}} + \frac{1}{\lambda_{2}}\cdot\frac{\lambda_{1}}{\lambda_{1} + \lambda_{2}} + \frac{1}{\lambda_{1}}\cdot\frac{\lambda_{2}}{\lambda_{1} + \lambda_{2}} $$
Then, the long run average cost per unit time is simply $E[C]$/$E[T]$.
My question is: Could someone explain the logic behind this specific derivation of $E[C]$ and $E[T]$, componentwise?
I am not immediately seeing how this was the arrived at solution for $E[C]$ and $E[T]$.
 A: Let $C(t)$ be the cost accumulated up to time $t$, $M^{(i)}_n$ be the $n^{\mathsf{th}}$ lifetime of machine $i$ and $$T_n=\sum_{k=1}^n \left(M^{(1)}_n+M^{(2)}_n\right).$$ Then $\{C(t):t\geqslant 0\}$ is a regenerative process with epochs $\{T_n\}$, and so by the renewal-reward theorem, $$\lim_{t\to\infty} \int_0^t C(s)\ \mathsf ds = \frac{\mathbb E[C]}{\mathbb E[T]} $$ where $C$ and $T$ is the cost over the the first cycle and $T$ the length of the first cycle. We compute
\begin{align}
\mathbb E[T] &= \mathbb E[M^{(1)}\wedge M^{(2)}] + \mathbb E[M^{(1)}\vee M^{(2)}]\\
&= \frac1{\lambda_1+\lambda_2} +  \mathbb E[M^{(1)}\vee M^{(2)}\mid M^{(1)}< M^{(2)}]\mathbb P(M^{(1)}< M^{(2)})+\mathbb E[M^{(1)}\vee M^{(2)}\mid M^{(1)}> M^{(2)}]\mathbb P(M^{(1)}> M^{(2)})\\
&= \frac1{\lambda_1+\lambda_2} + \frac1{\lambda_2}\cdot\frac{\lambda_1}{\lambda_1+\lambda_2} + \frac1{\lambda_1}\cdot\frac{\lambda_2}{\lambda_1+\lambda_2}
\end{align}
and
\begin{align}
\mathbb E[C] &= K + c_2\mathbb E[M^{(1)}\wedge M^{(2)}]+ c_1\mathbb E[M^{(1)}\vee M^{(2)}]\\
&= K + \frac{c_2}{\lambda_1+\lambda_2} + c_1\left( \frac1{\lambda_2}\cdot\frac{\lambda_1}{\lambda_1+\lambda_2} + \frac1{\lambda_1}\cdot\frac{\lambda_2}{\lambda_1+\lambda_2}\right).
\end{align}
