Limits 1s, 1.0 GB

Robin Sparkle went to the mall one day. While shopping, she remembered that she has a homework due the next day. She recalled that she has to solve a problem regarding a quadrilateral inscribed in a circle.

Robin gives you the following information about the quadrilateral:

a,b,ca,b,c: Lengths of three arbitrarily chosen sides of the quadrilateral.

rr: Radius of the circle it is inscribed in.

Help her calculate the area of the quadrilateral. Robin's robot has broken down trying to solve this problem. You are her only hope.

Input

The first line of the input will contain an integer TT (1T1051\leq T\leq 10^5) denoting the number of test cases. TT lines follow. Each of these lines contain four positive real numbers aa, bb, cc (0<a,b,c2r0 < a,b,c \leq 2r) and rr (0<r2000 < r \leq 200). These numbers may contain up to 7 digits after the decimal point.

The sum of lengths of the arcs cut by any two of the given sides is greater than or equal to the length of the arc cut by the other side. You can safely assume that the sides form a simple convex polygon and the fourth side has a positive length.

Output

For each case, you have to print the area of the inscribed quadrilateral on a separate line. Absolute error less than 10610^{-6} will be ignored.

Sample

InputOutput
2
14.1421356 14.1421356 14.1421356 10
7 7 7 5
200.0000000
49.9700030

This image represents the first case given in the sample. The radius is of length 10 and the lengths sides of the quadrilateral are same, 10210\sqrt 2. Hence, the area of the quadrilateral is (102)2=200(10\sqrt 2)^2 = 200.


Submit

Login to submit.

Statistics

89% Solution Ratio
ovis96Earliest, Dec '18
nusuBotFastest, 0.1s
foysal12345Lightest, 1.4 MB
Fazlerabbi.Shortest, 474B
Toph uses cookies. By continuing you agree to our Cookie Policy.