407713: GYM102881 B Anany in the Army

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Anany in the Armytime limit per test2 secondsmemory limit per test64 megabytesinputsticks.inoutputstandard output

Anany was happily doing his military service, but someday he got bored. He was daydreaming about the moment he gets back to problem-solving when he suddenly noticed three sticks on the ground. He challenged his soul (pun intended) to solve the following problem:

You can choose $$$\textbf{one}$$$ stick and increase its length by any amount (integer or non-integer) less than or equal to $$$k$$$ units. You will then form a triangle using the sticks. What is the maximum area of a triangle that you can get?

Input

The first line of input contains an integer $$$T$$$, the number of test cases.

Each of the next $$$T$$$ lines contains 4 space-separated integers each — the lengths of the 3 sticks, followed by $$$k$$$.

All the numbers are positive integers and do not exceed $$$10^4$$$.

It's guaranteed you can always form a non-degenerate triangle.

Output

For each test case, print the maximum area on a single line. The answer will be considered correct if its absolute or relative error does not exceed $$$10^{-4}$$$.

ExampleInput
2
1 1 1 2
3 4 4 1
Output
0.500000000
6.928203230

Source/Category

加入题单

算法标签: