Limits 1s, 512 MB

The famous kingdom of Five Brothers' are prospering more than ever. Now, they want to have a flag of their own. Designing a flag requires a lot of geometrical skills and the kingdom has started a contest to find the proper designer with the necessary skills. They have published a problem on their new website. Whoever solves the problem first, will have the honor to design the prestigious flag of the kingdom. The problem is as follows:

For the picture above, you will be given the coordinates of points A, B, C and the coordinates of I and J. Here I and J are the centroids for the triangle AHC and the triangle BCF respectively. You will have to calculate the difference between the area of ACDG and BCEG. Here AC, and HD, CE and BG , AG and CD is parallel. Points G,F and E are on the line segment HD and point B is on the line segment AC.

Input

Input starts with an integer T (1<= T <=105) denoting the number of test cases.

Each test contains 5 lines. Each line contains two real numbers, the x and y coordinates of a point.

The five lines contain the coordinates of the points A, B, C, I and J respectively.Absolute value of all co-ordinates is less than 104.

Output

For each case print the difference between the area of ACDG and BCEG. Absolute error less than 10-4 will be ignored.

Sample

InputOutput
2
4.99556616 -1.30633702
5.83548072 -1.30633702
7.18093053 -1.30633702
4.39331301 -3.4363381
2.48881069 -3.4363381
4.52949197 -2.78772135
6.06777891 -2.78772135
7.62533308 -2.78772135
5.66155751 -1.63833943
3.49398444 -1.63833943
5.367056760
5.304237590

Submit

Login to submit.

Statistics

77% Solution Ratio
anparvez10Earliest, Oct '19
ShamimSarkerFastest, 0.0s
ShamimSarkerLightest, 5.4 kB
PSTU_MeteorsShortest, 489B
Toph uses cookies. By continuing you agree to our Cookie Policy.