E - Throwing the Die Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 500

問題文

サイコロを使ったゲームをします。ゲームは最大 N 回のターンからなり、各ターンは次のように進行します。

  • 1,\ldots,6 の目が等確率で出る 6 面ダイスを振り、出目を X とする(出目は各ターンで独立とする)。
  • 現在が N ターン目なら、スコアX とし、ゲームを終了する。
  • そうでないとき、ゲームを続行するか終了するか選択する。
    • ゲームを終了する場合、スコアを X とし、残りのターンは行わずにゲームを終了する。

スコアの期待値が最大になるように行動したとき、スコアの期待値を求めてください。

制約

  • 1 \leq N \leq 100

入力

入力は以下の形式で標準入力から与えられる。

N

出力

答えを出力せよ。
なお、真の解との絶対誤差または相対誤差が 10^{-6} 以下であれば正解として扱われる。


入力例 1

1

出力例 1

3.5000000000

入力例 2

2

出力例 2

4.2500000000

入力例 3

10

出力例 3

5.6502176688

Score : 500 points

Problem Statement

Let us play a game using a die. The game consists of at most N turns, each of which goes as follows.

  • Throw a 6-sided die that shows 1,\ldots,6 with equal probability, and let X be the number shown (each throw is independent of the others).
  • If it is the N-th turn now, your score is X, and the game ends.
  • Otherwise, choose whether to continue or end the game.
    • If you end the game, your score is X, and there is no more turn.

Find the expected value of your score when you play the game to maximize this expected value.

Constraints

  • 1 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.
Your output is considered correct if its absolute or relative error from the true answer is at most 10^{-6}.


Sample Input 1

1

Sample Output 1

3.5000000000

Sample Input 2

2

Sample Output 2

4.2500000000

Sample Input 3

10

Sample Output 3

5.6502176688