As the term is going to end, DRD begins to write his final article.
DRD uses the famous Macrohard's software, World, to write his article. Unfortunately this software is rather unstable, and it always crashes. DRD needs to write $n$ characters in his article. He can press a key to input a character at time $i+0.1$, where $i$ is an integer equal or greater than 0. But at every time $i-0.1$ for integer $i$ strictly greater than 0, World might crash with probability $p$ and DRD loses his work, so he maybe has to restart from his latest saved article. To prevent write it again and again, DRD can press Ctrl-S to save his document at time $i$. Due to the strange keyboard DRD uses, to press Ctrl-S he needs to press $x$ characters. If DRD has input his total article, he has to press Ctrl-S to save the document.
Since World crashes too often, now he is asking his friend ATM for the optimal strategy to input his article. A strategy is measured by its expectation keys DRD needs to press.
Note that DRD can press a key at fast enough speed.