A quick check reveals that the probability of going bust after $1$ step is given by $C_0(1-p)$. Here $C_i$ is the $i$-th Catalan number. Going bust after $3$ steps is given by $C_1p(1-p)^2$ and $5$ steps is given by $C_2p^2(1-p)^3$, So we can see the pattern. So the answer for your question is the following sum: $$(1-p)\sum_{i=0}^{\infty}(2i+1)C_i(p(1-p))^i$$ You can calculate the sum by using the well-known generating function for the Catalan numbers: $$c(x)=\sum_{i=0}^{\infty}C_ix^i=\frac{1-\sqrt{1-4x}}{2x}$$ Now if you look at $\frac{d (xc(x^2))}{dx}$ and then plug in $x=\sqrt{p(1-p)}$ and then multiply by $1-p$ you get the answer given by the series above. Doing so gives us the answer of $\frac{1-\sqrt{(1-2p)^2}}{2p\sqrt{(1-2p)^2}}$. Which if $p\geq 1/2$ gives $1/(1-2p)$ and if $p< 1/2$ it gives $\frac{(1-p)}{p(2p-1)}$. In your case this is equal to $10$ as mentioned by the other answer. We can verify this by a simple Monte-Carlo simulation as below: from scipy.stats import bernoulli p=0.45 tries=50000 steps_array=[] def experiment(array): steps=0 money=1 while money>0: r = bernoulli.rvs(p, size=1) if r==1: money+=1 steps+=1 else: money-=1 steps+=1 array.append(steps) return while tries>0: experiment(steps_array) tries-=1 print(sum(steps_array)/len(steps_array)) Doing so I got the answer 9.96044 which is pretty close to the answer calculated above.