Another Dice Game

No attempts yetTime limit1sMemory limit128 MB

Problem

In the game Pickomino (also known in the Netherlands as Regenwormen) you must roll 8 dice to reach at least a given target score. The rules are as follows.

  • Each die shows the values 1, 2, 3, 4, 5 and a worm. The dice are fair, so every outcome is equally likely.
  • The game starts by rolling all dice.
  • After a roll, the player must pick one of the six possible values and set aside every die showing that value. At least one die must show the chosen value.
  • After setting some dice aside, the player may either roll the remaining dice again or stop. The player may only stop once at least one worm has been set aside.
  • Each value may be chosen at most once during the game.
  • When the player stops, the total score is the sum of the values of the dice that were set aside. A worm is worth 5 points.
  • The player gets stuck if any of these happen: the roll shows only values that were already set aside, all dice have been set aside without a worm, or the target score has not been reached.
  • A stuck player scores 0 points and the game ends.

Jan is playing and wants to score at least $n$ points. Using an optimal strategy, what is the probability that Jan reaches this target?

Input

The first line contains one positive integer: the number of test cases (at most 100).

Each of the following test cases consists of one line with the integer $n$ ($1 \le n \le 40$): the target score.

Output

For each test case, print one line with the probability of scoring at least $n$ points under an optimal strategy, rounded to exactly 10 decimal places.

Hint

To reach 5 points it is enough to roll at least one worm, so the optimal strategy is to stop as soon as you have a worm. If you did not roll a worm, you should set aside as few dice as possible to maximize the chance of rolling a worm on a later roll.