Shoot the Target

Pick the ground point on the x-axis that makes the given segment look widest and output that largest angle in degrees.

Medium6GeometryMathNo attempts yetTime limit5sMemory limit512 MB

Problem

Kazuki plays an artillery game. A target hangs in the air above flat ground, and the target is slanted, so it is not perpendicular to the ground. Kazuki may shoot from any point on the ground, and he wants to stand where the target looks widest. Find the largest visible angle of the target in degrees.

The world is the 2D plane with the y-axis pointing up toward the sky. The ground is the x-axis. The target is the line segment joining the two endpoints (X1,Y1)(X_1, Y_1) and (X2,Y2)(X_2, Y_2).

The visible angle from a ground point (X,0)(X, 0) is the angle at the vertex (X,0)(X, 0) formed by (X1,Y1)(X_1, Y_1), (X,0)(X, 0) and (X2,Y2)(X_2, Y_2). The XX that maximizes the angle is not necessarily an integer.

Input

The first line has the number of test cases TT. Each of the next TT lines has four integers X1X_1, Y1Y_1, X2X_2, Y2Y_2 separated by spaces, the coordinates of the two ends of the target.

Limits

  • 1T1001 \le T \le 100
  • X1X2X_1 \ne X_2
  • 1Y1,Y21000001 \le Y_1, Y_2 \le 100000
  • 100000X1,X2100000-100000 \le X_1, X_2 \le 100000

Output

For each test case, print one line of the form Case #t: Z, where t is the case number starting from 1 and Z is the largest visible angle of the target in degrees. Print Z rounded to exactly four digits after the decimal point, always with all four digits. An answer of exactly 90 degrees prints as 90.0000.