- All Contests
- ProjectEuler+
- Project Euler #232: The Race

# Project Euler #232: The Race

# Project Euler #232: The Race

_{This problem is a programming version of Problem 232 from projecteuler.net}

Two players share an unbiased coin and take it in turns to play "The Race". On Player 1's turn, he tosses the coin once: if it comes up Heads, he scores one point; if it comes up Tails, he scores nothing. On Player 2's turn, she chooses a positive integer and tosses the coin times: if it comes up all Heads, she scores points; otherwise, she scores nothing. Player 1 goes first. The winner is the first to or more points.

On each turn Player 2 selects the number, , of coin tosses that maximises the probability of her winning.

What is the probability that Player 2 wins? As the number is obviously rational and can be represented as with integer and , write the answer as

**Input Format**

The first line of each test file contains a single integer , that is the number of queries. lines follow, each containing a single integer .

**Constraints**

**Output Format**

Print exactly lines with the answer to the corresponding query on each line.

**Sample Input 0**

```
1
1
```

**Sample Output 0**

```
333333336
```

**Explanation 0**

The answer is which is equal to