This looks like a straightforward recurrence, but I have an impression I made a mistake somewhere. In this equation $G_n$ is a random variable
$ G_n=\left\{ \begin{array}{c c} 0 & 1-p_n \\ a_n & p_n \\ \end{array} \right. $
Obviously $\mathbf{E}G_n=a_n p_n$ and border condition is $A_1=1$. So the obvious solution to the problem seems to be
$ A_{n+1}=1+\sum_{j=2}^{n}a_j p_j $
I find this solution way too simple. Do I have to use a generating function somewhere? I had this article in mind when thinking of this problem.