The Queen's Terrace

No attempts yetTime limit1sMemory limit256 MB

Problem

The queen wants a terrace garden. The garden is one stone in the middle and several rings of stones around it.

  • The middle stone is a circle of radius 11.
  • Each ring is built from NN circular stones of equal size laid out around the middle. Every ring holds the same number NN of stones, but the stone size changes from ring to ring.
  • Two neighboring stones in the same ring touch each other.
  • The stones of the first ring touch the middle stone.
  • From the second ring on, each stone touches a stone of the ring just inside it. An outer ring is rotated by half a step against the ring inside it, so one stone of the outer ring touches two neighboring stones of the inner ring at the same time.

The queen has not fixed NN and MM yet, so she wants the size of the terrace worked out in advance for many combinations. The terrace is the shortest convex boundary that encloses every stone of the outermost ring. That boundary is made of the outer arc of each stone and the segments joining the arc ends of neighboring stones.

For a garden with MM rings, find the radius of a stone in the last ring and the perimeter of the terrace.

Input

The first line holds the number of test cases PP. (1P10001 \le P \le 1000)

Each of the next PP lines holds the test case number TT, the number of stones NN in one ring, and the number of rings MM, separated by spaces. (3N203 \le N \le 20, 1M151 \le M \le 15) TT is an integer.

Output

For each test case print one line with the test case number TT, the radius of a stone in the last ring, and the perimeter of the terrace, separated by single spaces.

Round both real numbers at the fourth decimal place and print three decimal places. Rounding is half up, and an integral value still shows all three decimals. The output must match the answer character for character.

The answer grows as NN gets smaller and MM gets larger. The radius reaches about 5.6×10145.6 \times 10^{14} and the perimeter about 6.9×10156.9 \times 10^{15}, so double precision alone cannot pin down the third decimal. Compute with higher precision.