# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

## Robin Sparkles

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.

$a,b,c$: Lengths of three arbitrarily chosen sides of the quadrilateral.
$r$: 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 $T$ denoting the number of test cases. $T$ lines follow. Each of these lines contain four positive real numbers $a, b, c$ and $r$. These numbers may contain up to 7 digits after the decimal point.

#### Constraints:

$1\leq T\leq 10^5$
$0<r\leq200$
$0<a,b,c \leq 2r$
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 $10^{-6}$ will be ignored.

### Samples

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, $10\sqrt 2$. Hence, the area of the quadrilateral is $(10\sqrt 2)^2 = 200$.

Author
• #### Labib666

Labib loves to solve problems unless confronted with real life ones which he procrastinates upon with food and sitcoms.
Discussion
Submit