Last time, Hanamichi lost the basketball battle between him and Rukaw. So these days he had a burning desire to wreak revenge. So he invented a new game and asked Rukaw to play with him. What’s more, the loser should confess his ignorance and on the other hand the winner can go on a trip with Haruko.
Hanamichi knows the game well (as he invented it), and he always chooses the best strategy, however Rukaw is not so willing to play this game. He just wants it to be finished as soon as possible so that he can go to play basketball. So he decides not to think about the best strategy and play casually.
The game’s rules are here. At first, there are N numbers on the table. And the game consists of N rounds. Each round has a score which is the number of the numbers still left on the table. And Each round there will be one number to be removed from the table. In each round, two players take turns to play with these numbers.To be fair, Rukaw plays first in the first round. If there’s more than 1 numbers on the table, players can choose any two numbers they like and change them to a number abs(x-y). This round ends when there’s only one number left on the table, and if this number is an odd number, Rukaw wins, otherwise Hanamichi wins. The score of this round will be add to the winner. After that, all numbers will be recovered to the state when this round starts. And the loser of this round has the right to remove one number and he also has the right to play first in the next round. Then they use the remaining numbers to start next round. After N rounds, all numbers removed and this game ends. The person who has more scores wins the whole game.
As you know, Rukaw has already decided to play casually, that is to say, in his turn, he chooses numbers randomly, each numbers left on the table has the same possibility to be chosen. When a round ends, if Rukaw is the loser, he also randomly chooses a number to remove. And Hanamichi will always choose numbers or remove numbers to maxmium his final total score. Here comes the question:
Given the N numbers on the table at the beginning, can you calculate the expectation of the final score of Hanamichi. (We don’t care about who wins the whole game at all.)