Hide

Problem K
Monty's Hall

/problems/montyshall/file/statement/en/img-0001.jpg
This could be you if you choose poorly.
Photo by Armin Kübelbeck, cc-by-sa, Wikimedia Commons
You have explored the deep catacombs under a long lost city for the past couple of hours and finally you have reached their end: The hall of the undead wizard Monty. His restless spirit materialises in front of you and you prepare for battle.

However, it turns out that you are the first explorer to find him in over a hundred years, so he has grown incredibly bored. Instead of a fight, he offers to play a game for his artefacts. The hall has $d$ closed doors, but only one of them leads to the artefacts (Monty knows which one it is, of course). The procedure is as follows:

  1. You choose $s$ closed doors.

  2. Monty opens $e$ doors that were not selected by you and lead to empty rooms.

  3. Among the remaining closed doors, you may change your selection of $s$ doors however you want (you can even stay with your current selection if you wish to).

  4. Monty reveals which door leads to the room with his artefacts.

If the door with the artefacts is among your selected doors, you win and can take them with you unscathed. If not, Monty will transform you into a goat. So you better hope your luck is on point today.

Input

The input consists of:

  • One line with three integers $d$, $s$ and $e$ ($1 \le d,s,e \le 10^{6}, s + e < d$), the number of doors in Monty’s hall, the number of doors you are allowed to select and the number of doors Monty opens in step 2.

Output

Output your chance to win at Monty’s game when playing optimally. Your answer should have an absolute or relative error of at most $10^{-6}$.

Sample Input 1 Sample Output 1
3 1 1
0.666667
Sample Input 2 Sample Output 2
8 4 2
0.75
Sample Input 3 Sample Output 3
15 4 2
0.32592593

Please log in to submit a solution to this problem

Log in