This page is still under construction.

Parts of this page are still being built. What you see may change.

Biggest Slice

Time limit2sMemory limit256 MB

Summary
Compute the largest slice area from n radial cuts where each cut rotates by a fixed angle around the circle center.
Level

Medium7 of 10

Topics
Number theory, Math, Geometry
Solved
No attempts yet

Problem

You share one large circular pizza with n−1n-1 friends. You cut it like this. Rotate the pizza clockwise about its center by the angle θ\theta, then make one straight cut from the center to the right. Repeat the same rotation and the same cut nn times in total.

Unless θ\theta is chosen well, this is not a good way to divide a pizza. Some slices come out larger than others, and when cuts land on top of each other you get fewer than nn slices. You do not care about fairness. The largest slice is yours, so you only want its area.

Input

The first line contains the number of test cases mm. (1≤m≤2001 \le m \le 200)

Each of the next mm lines holds one test case. A line gives the pizza radius rr in centimeters, the number of people sharing the pizza nn, and the rotation angle θ\theta, in that order. rr is an integer with 1≤r≤1001 \le r \le 100, and nn is an integer with 1≤n≤1081 \le n \le 10^8. θ\theta is given as three integers, its degrees, its arcminutes, and its arcseconds. The degrees are between 00 and 359359, the arcminutes and the arcseconds are each between 00 and 5959, and θ\theta is greater than 00.

Output

For each test case, print the area of the largest slice in square centimeters on its own line, rounded to six digits after the decimal point.

Examples2

  1. Example 1

    Input
    4
    20 6 60 0 0
    20 6 59 59 59
    30 20 33 30 0
    40 200 120 0 0
    
    Expected output
    209.439510
    209.444358
    263.108385
    1675.516082
    
  2. Example 2

    Input
    5
    10 1 90 0 0
    10 2 90 0 0
    10 3 90 0 0
    10 4 90 0 0
    10 5 90 0 0
    
    Expected output
    314.159265
    235.619449
    157.079633
    78.539816
    78.539816