Limits 1s, 512 MB

You are given radius $R$ of a circle. Let’s call it “Main Circle”. You have to draw $N$ circles outside this main circle such that they follow the rules below $-$

(Compare with the picture below for better understanding)

  1. Every outer circle touches the main circle.

  2. Every outer circle touches exactly two more outer circles.

Find the area of the blue region.

Input

The first line contains an integer $T$ $\left(1 ≤ T ≤ 10^3\right)$, the number of test cases.

The next $T$ lines contains two integers, $R$ $\left(1 ≤ R ≤ 10^5\right)$ — radius of the main circle and $N$ $\left(3 ≤ N ≤ 10^5\right)$ — number of outer circles.

Output

For each test case, print the area of the blue region.

Your answer is considered correct if its absolute or relative error doesn't exceed $10^{-6}$. Namely, if your answer is $a$, and the jury's answer is $b$, then your answer is accepted, if $\frac{|a-b|}{max(1, |b|)} \leq 10^{-6}$

Sample

InputOutput
3
3 8
4 4
500 8
5.927964
29.785152
164665.680333

Submit

Login to submit.

Contributors

Statistics

95% Solution Ratio
woolgathererEarliest, Feb '21
Arif2006Fastest, 0.0s
woolgathererLightest, 131 kB
abu_fayeemShortest, 210B
Toph uses cookies. By continuing you agree to our Cookie Policy.