# Quit while you're ahead

**Discrete Mathematics**Level 4

You play the following game:

Roll a fair 6-sided die as many times as you like.

- If it's any integer between 1 to 5 inclusive, you win $100.
- If it's a 6, you lose all your money and the game ends.

You can continue to roll, winning $100 every time it's not a 6. You can also decide to quit at any time, having not yet rolled a 6, and keep all of your winnings.

What is the optimal number of rolls at which you should "call it quits"? i.e. For what number, \(n\), should you decide ahead of time, "I'm gonna continue to roll until I've done \(n\) rolls (assuming I haven't lost all my money yet) and then I should quit."

Give your answer as the sum of all the numbers for which you **maximize** your expected value of the game. So, for example, if there are two such numbers for which you maximize your expected payoff, \(m\) and \(n\), please give your answer as the sum \(m+n\).