TETRA - Sphere in a tetrahedron

Of course a Sphere Online Judge System is bound to have some tasks about spheres. So here is one. Given the lengths of the edges of a tetrahedron calculate the radius of a sphere inscribed in that tetrahedron (i.e. a sphere tangent to all the faces).

Input

Number N of test cases in a single line. (N ≤ 30) Each of the next N lines consists of 6 integer numbers -- the lengths of the edges of a tetrahedron separated by single spaces. The edges are not longer than 1000 and for the tetrahedron WXYZ, the order of the edges is: WX, WY, WZ, XY, XZ, YZ.

Output

N lines, each consisting of a real number given with four digits decimal precision equal to the radius of a sphere inscribed in the given tetrahedron.

Example

Input:
2
1 1 1 1 1 1
1000 999 998 5 5 6

Output:
0.2041
1.4189

Added by:Adam Dzedzej
Date:2004-05-11
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET

hide comments
2015-12-11 13:58:14
If you have good answers for the example and SPOJ gives "Wrong Answer", then you probably don't include the situation, where one (or more) of the edges is 0. If one is zero, therefore the radius is 0. Your program should also write 0 not as "0", but as "0.0000".
2015-01-18 07:38:31 Kaushik Nath
Remember to take care of the decimal places
It should be only 4
2014-12-12 22:47:34 Manu Agarwal
would anyone suggest me critical test cases . Getting WA even after right answer in sample test cases.
2014-11-29 05:13:03 Minsuk Kim
weird - I'm getting correct answers for sample test cases but keep on getting wrong answer on submission too .... :(
2014-10-30 10:08:07 aky
I am using C math library for sqrt etc and I am getting answer to the second one as 1.4186. Answer to first is correct! What's wrong with this approach?
2014-06-11 21:50:41 hackab
#heron's formula .. :)
2014-06-03 15:35:26 Deekshith Reddy Kallem
@sai spoorthy,1000 5 6 in the above problem do not form the sides of single face. 5 5 6 form the base triangle
2014-05-22 18:26:04 sai spoorthy
i am getting answer for first one as 0.022680460581325723
in the second test case
for every tetrahedron there will be 4 triangles
but 1000 5 6 it cannot form triangle as sum of two sides is not greater than the other side
please help me!!!!!!!!!!!!!!!


Last edit: 2014-05-22 18:49:55
2013-12-29 08:25:16 yaswanth
100th one :)
2013-07-08 15:56:11 shikhar sharma
I am able to get the right answer for the sample test cases but still getting WA on submission.
Can someone please provide more testCases
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.