# Gamblers ruin and the mean time calculating

There's a gambler with initial money $$k=100\$$. He plays till bankruptcy or till having $$N=500\$$. In every game he wins $$100\$$ with probability $$p=\frac{1}{2}$$, loses $$100\$$ with probability $$q=\frac{1}{4}$$ or the game ends in tie with probability $$r=\frac{1}{4}$$.