Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Omae Wa Mou Shindeiru

By Chronos · Limits 1s, 512 MB

Itachi and Sasuke are trying to beat Kabuto, the caster of an awesome magical spell (or you can say jutsu). Kabuto has a power level of N. The fight between them is quite weird. There’s a bag with some potions that contain power. There are exactly N potions in the bag and the i’th potion has a power level of i (i starts from 1).

Itachi and Sasuke each pull out a random potion from the bag simultaneously. If the power level of each of their potions is co-prime with N and the sum of their power levels is greater than N, then Itachi and Sasuke say to Kabuto, “Omae Wa Mou Shindeiru”. Kabuto then shouts, “NANI???” and dies with a poof!!!

As you are a great mathematician and programmer and they are not, can you tell what is the probability that Itachi and Sasuke can say, “Omae Wa Mou Shindeiru”???

Input

There will be several test cases. The first line will contain an integer T (1 <= T <= 1000) denoting the number of test cases.

The next T lines each will contain an integer N (2 <= N <= 1015), the power level of Kabuto.

The inputs are randomly generated.

Output

For each test case, print the probability of Itachi and Sasuke saying “Omae Wa Mou Shindeiru” in a new line. Your answer should be rounded to exactly 10 digits after the decimal.

Sample

InputOutput
2
2
3
0.0000000000
0.0000000000


Discussion
Statistics

78% Solution Ratio

NirjhorEarliest, 2w ago

NirjhorFastest, 0.0s

NirjhorLightest, 131 kB

magic_kiriShortest, 1970B

Submit

Login to submit