GCOOP - Cooperation in geometry !

no tags 

Aang is fond of geometric figures, especially with equilateral triangles. He likes to know how well equilateral triangles cooperate with other figures. He initially takes an equilateral triangle of side t1. He also takes a square of side a, rectangle of dimensions l and b, another equilateral triangle of side t2 and a circle of radius r. He then takes turn and places each figure near the initial equilateral triangle of side t1. While placing nearer, he can place those figures in any orientation, any two edges of the two figures can be along same line but the figures cannot overlap. He now needs to find a cooperation value which is the minimum area of the rectangle needed to surround the area of the two figures. For example, when he places a square near a triangle, the cooperation value is the area of the smallest rectangle which can surround the areas of the triangle and square. Now, given the values, find the cooperation values of all the figures with the initial equilateral triangle.

Input

First line consists of t, the number of test cases (1 <= t <= 20)

Next t lines consists of 6 values t1, a, l, b, t2 and r denoting side of first triangle, side of square, length and breadth of rectangle, side of second triangle and radius of circle. (all values will lie between 1 and 100 inclusive)

Output

For each test case, print a single line consisting of the cooperation values of the first triangle with the square, rectangle, circle and the other triangle respectively. (separated by spaces rounded off to 4 decimal digits)

Example

Input:
1
2 2 2 3 2 1

Output:
7.4641 9.4641 7.4641 5.1962

hide comments
Oleg: 2023-12-22 17:45:50

Indeed. Seems nice problem with invalid tests.
https://imgur.com/s0Qq24F - Has better cooperation value (7.1547) for triangle and circle.

gannicus: 2013-12-28 10:25:11

@pandian: In the given test case, if we will adjust the circle in a triangle , n then we will get an equilateral triangle..nd then find the area of rectangle which can fit both these triangle..resultant area will be around 4.7321 which is lesser.

Kanish: 2013-12-27 11:03:20

@pandian: could u check my submission id:10747590 plz..

Derek Illchuk: 2013-12-26 18:01:22

In the example of triangle t1 = 2 and circle r = 1, can't you place (taller) circle next to triangle, lined up at their base/bottom, making bounding box (2*r) * (t1 + r/sqrt(3) + r) = 7.1547 vs the stated 7.4641?

Bhavik: 2013-12-25 16:27:25

@pandian :are values in input integer or can be real numbers?
kindly chk id:10737644

Last edit: 2013-12-25 20:05:36
anurag garg: 2013-12-25 13:29:16

@pandian: can you have a look at my submission & can you provide the test cases where it fails...
submission id:10735092
thanks


Added by:Pandian
Date:2013-12-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own