Casino
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 S[p]
points and croupier has S[c]
points, than player wins if and only if (S[p]
≤ 21 and (S[c]
> 21 or S[c]
< S[p]
)).
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.
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).
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.
Finally, croupier rolls dice several times. As mentioned above, croupier uses optimal strategy.
We call strategy optimal 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% chance to win!
Input
Contains one integer x (0 ≤ x ≤ 1000).
Output
Print one number - probability of Andrew's win. Your answer must be accurate up to 10^(-5)
.