Solution (source code)

= Solution

Distinguish the production type as well as the stopping position. The <sample space> has the six outcomes
$$
\boxed{\Omega=\{G\cap x_0,G\cap x_1,G\cap x_2,D\cap x_0,D\cap x_1,D\cap x_2\}.}
$$
Here $x_k$ in an event means $X=x_k$. Their joint <probabilities> are $pg_k$ and $(1-p)d_k$, respectively. The conditional stopping laws obey $\sum_{k=0}^2g_k=\sum_{k=0}^2d_k=1$; with the stated strict positivity all six outcomes are possible.