Suppose that we are at a casino, we have $m$ money, we can place bets of any size $x$ and win with probability $p<0.5$ (if we win we get $2x$ money) , but we need to place bets which add up to at least $\alpha$ dollars in order to withdraw our money.
What is the expected amount of money we can win if we play optimally? Call this $F(m,\alpha)$.
Clearly we have $F(m,0)=m$ and we have $F(m,\alpha)=\max\limits_{0< x \leq \alpha,m}(pF(m+x,\alpha-x)+(1-p)F(m-x,\alpha-x))$, so we get a nice recursion for $F$ over $\alpha$.
Does a closed form exist? I think that the recursion $F(m,\alpha)=pF(m+\min(\alpha,m),\alpha-\min(\alpha,m))+(1-p)F(m-\min(\alpha,m),\alpha-\min(\alpha,m)))$ is true but I haven't been able to prove it.
Is this problem famous?
If the total amount of money we bet (in one or more rounds) is $\alpha'$, then the expected loss from these bets is $(1-2p)\alpha'$. Thus for $\alpha\le m$, the optimal strategy is to bet a total of $\alpha$ (in a single bet or with several bets, it doesn't matter) and then withdraw an amount $m'$ with expected value $$E[m']=m-(1-2p)\alpha\qquad(\alpha\le m)$$
Things get more complicated if $\alpha>m$. We need to reach the winning zone even to withdraw! We will certainly stop as soon as the total bets add up to $\alpha$ (as any further betting produces expected loss), but we may be broke before that after having bet only $\alpha'<\alpha$. By this, the expected value $E[\alpha']$ of total bet amount may be smaller than $\alpha$. At any rate, we still have $E[m']=m-(1-2p)E[\alpha']$. This tells us that we want to minimize $E[\alpha']$. In other words, try to be broke as quick as possible if you fail to win. This reminds us of "How to gamble if you must" and the recommendation to use bold play, i.e., in each round bet as much as we need to reach a preselected target amount $m'$ at once if possible, or otherwise bet all we have.
Adapted to our situation: As long as the remaining $\alpha$ is greater than $m$, bet all you have. If we lose, we win nothing, otherwise start the same considerations with $\alpha$ replaced by $\alpha-m$ and $m$ replaced by $2m$.
If we denote $F(\alpha,m)$ as the value of $E[m']$ for the given $\alpha$ and $m$, we thus obtain the recursive functional equation $$ F(\alpha,m)=\begin{cases}m-(1-2p)\alpha&\text{if }\alpha\le m,\\ pF(\alpha-m,2m)&\text{if }\alpha\ge m.\end{cases}$$ Clearly (and as we might have guessed), $F$ is homogeneous. To simplify, we define $f(x):=\frac1mF((x-1)m,m)$ (so that $F(\alpha,m)= mf(\frac\alpha m+1)$) and see that this obeys $$ f(x)=\begin{cases}1-(1-2p)(x-1)&\text{if }1\le x< 2,\\ 2pf(\frac x2)&\text{if }x\ge2.\end{cases}$$ Thus for $2^k\le x< 2^{k+1}$, we take the lower branch of the recursion $k$ times and then the top branch. Summarized in one single closed formula, we arrive at $$f(2^ku)=(2p)^k(1-(1-2p)(u-1))\qquad\text{if }1\le u<2$$ or at $$f(x)=(2p)^{\lfloor \log_2 x\rfloor } \bigl(1-(1-2p)(2^{-\lfloor \log_2x\rfloor }x-1)\bigr).$$