Limits 1s, 512 MB

Tanjiro and his sister Nezuko live in a village that is shaped like a circle with a radius R. There's also a crazy boy Zenitsu who loves Nezuko but he is so annoying that Tanjiro doesn't want him anywhere near his sister Nezuko, the cutest of all. So, he gives punishment to Zenitsu.

Zenitsu must start running from a point on the circle boundary to some inward direction. He runs in a straight line. Whenever he reaches a point on the boundary of the circle (say such a point is A), his direction is reflected with respect to the line connecting A and the centre of the circle. And he starts running again. He only stops running when he reaches the point from which he started running initially.

Tanjiro wants Zenitsu to run in such a way that before he stops running, his direction is reflected exactly N times. Besides, Tanjiro wants Zenitsu to get as much tired as it's possible. So, Zenitsu has to choose the longest possible route where his direction reflects exactly N times before he stops running.

While running, Zenitsu keeps screaming "Ne-Zu-Ko chaaaaaaaaaaan" on top of his voice to express his love.

Can you help Zenitsu determine how much distance he has to cover?

Input

There will be several test cases.

In the first line, there will be an integer T (1 ≤ T ≤ 104), the number of test cases.

Each of the next T lines will contain two integers N (1 ≤ N ≤ 2 * 105) and R (1 ≤ R ≤ 103), the number of times Zenitsu's direction will reflect and the radius of the village, respectively.

Output

For each test case, output the distance of the longest route Zenitsu can take. The output should be rounded to 4 digits after the decimal.

Sample

InputOutput
2
1 1
2 4
4.0000
20.7846

Submit

Login to submit.

Contributors

Statistics

33% Solution Ratio
YouKnowWhoEarliest, Sep '19
rkb_rdFastest, 0.0s
rebornLightest, 262 kB
mashfiqur404Shortest, 150B
Toph uses cookies. By continuing you agree to our Cookie Policy.