Throwing the Die

AtCoder
IDabc266_e
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
1
Output #1
3.5000000000
Input #2
2
Output #2
4.2500000000
Input #3
10
Output #3
5.6502176688
API Response (JSON)
{
  "problem": {
    "name": "Throwing the Die",
    "description": {
      "content": "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 nu",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc266_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Let us play a game using a die. The game consists of at most $N$ turns, each of which goes as follows.\n\n*   Throw a $6$\\-sided die that shows $1,\\ldots,6$ with equal probability, and let $X$ be the nu...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments