Solution
= Solution
For $0\leq q<1$, the number of attempts has the <geometric distribution> with success <probability> $1-q$:
$$
\Pr(M_1=k)=q^{k-1}(1-q),\qquad k=1,2,\ldots.
$$
The <tail-sum formula for expectation> gives
$$
\boxed{\mathbb E M_1=\sum_{k=0}^{\infty}\Pr(M_1>k)=\sum_{k=0}^{\infty}q^k=\frac1{1-q}.}
$$
At $q=0$, $M_1=1$ deterministically. At $q=1$, $M_1=+\infty$ and its <expectation> is $+\infty$, rather than a finite waiting time.