Limits 1s, 256 MB

You probably heard of Professor Meiokoyi, a talented scientist. Recently she invented a new solution of Josephus problem.

Basically in the Josephus problem, We place $n$ people indexed from $1$ to $n$ in a circle and eliminate every second remaining person until there's only one remaining. The last person is our winner. If you still wondering what it is, then check this.

Suppose the index of the last person is $J(n)$. Now Professor Meiokoyi claims that $J(n)$ will always be $\displaystyle{\frac{n}{2}}$. So she submitted her invention to Hakayaki Science federation. Now the federation has some rules. They won't mark the invention valid until it's properly checked. So they will randomly choose a number $x$ from a range $L..R$ . If $J(x) = \displaystyle{\frac{x}{2}}$, they will mark the invention valid, otherwise not. Now you are given $L,R$ and you have to find the probability of getting her invention validated.

Input

In the first line, you're given an integer $Q$ ($1 \leq Q \leq 2 \times 10^5$).

Each of the next $Q$ lines will have two numbers $L, R$ ( $1 \leq L \leq R \leq 2^{63}-1$ ).

Output

For Each Query, print the probability of getting her invention valid. Suppose your answer is $x$ and the judge answer is $y$. Your answer will considered correct if and only if $ \mid y-x \mid ~~ \leq 10^{-8}$. Don't forget to print a newline after every answer.

Sample

InputOutput
2
5 10
20 40
0.166666667
0.000000000

Submit

Login to submit.

Statistics

83% Solution Ratio
EgorKulikovEarliest, Apr '20
nusuBotFastest, 0.0s
vipghn2003Lightest, 2.2 MB
Dipto_DebdipShortest, 237B
Toph uses cookies. By continuing you agree to our Cookie Policy.