Time limit per test: 0.25 second(s) Memory limit: 65536 kilobytes
input: standard output: standard
Consider the following dice game. Player rolls a regular dice (with the numbers 1 through 6 on its sides) several times and calculates total amount of points each time. Player can finish his turn after any roll. Thus, player should make at least one roll. If the sum exceeds 21, player loses. When player finishes, croupier rolls a dice using the same scheme. Player wins, if he or she has more points than croupier. More formally, if player has Sp points and croupier has Sc points, than player wins if and only if (Sp ≤ 21 and (Sc > 21 orSc < Sp)). The optimal croupier's strategy allows casino to win in more than 2/3 cases. But Andrew found the possibility to raise his chances to win! He will play together with Big Man. Big Man will bet X euros each game, while Andrew will bet 1 euro each game. In case of the win player gets his bet doubled. In case of the loss player gets nothing.
The scheme of the game is like following.
1. Big Man rolls dice several times and stops following the "best" strategy—the strategy that would be optimal if he played with croupier and without Andrew (he is really Big and doesn't care about little Andrew).
2. Than Andrew rolls dice several times. Andrew knows the amount of points Big Man has. Andrew is very smart boy and he realizes that croupier's strategy maximizes profit of the casino. So, Andrew uses optimal strategy using all those facts.
3. Finally, croupier rolls dice several times. As mentioned above, croupier uses optimal strategy.
We call strategy if it maximizes expected profit. If after the next roll any player or croupier have the same expected profit with the current value, he or she will prefer to roll the dice.
As Andrew calculated if X is big enough, he has almost 50 percents chance to win!
The input contains one integer X (0 ≤ X ≤ 1000).
Print one number—probability of Andrew's win. Your answer must be accurate up to 10-5.
Codeforces (c) Copyright 2010-2021 Mike Mirzayanov