Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Ellipse
Time Limit: 10000MSMemory Limit: 64000K
Total Submissions: 853Accepted: 129
Case Time Limit: 2000MSSpecial Judge

Description

Alex has got a tedious homework from his geometry teacher as a punishment for his conduct at geometry lessons --- Alex didn't do anything while the rest of his class was computing areas of different geometric figures!
Now, Alex has to compute the areas of several ellipses drawn on a sheet of paper torn from a textbook. This paper has a rectangular grid drawn on it which can be used to determine the coordinates of different points. However, the task of finding the area of an ellipse can be quite complicated even in this case, especially if the axes of the ellipse are not vertical or horizontal.
Of course, Alex is very lazy, so he wants you to write a program that would determine the area of an ellipse from the coordinates of five different points lying on it. He would then enter the coordinates of these points for each ellipse himself and thus compute the areas of all ellipses.

Input

The first line of the input contains the number of ellipses k (1 <= k <= 1 000). Each of the next k lines contains the coordinates of five points that lie on corresponding ellipse. All coordinates are integer and do not exceed 1 000 by their absolute values.

Output

On each of k lines of the output write either "IMPOSSIBLE" if the area cannot be determined (e.g. there is no ellipse passing through five given points, or there is more than one such ellipse) or the area itself precise to six digits after decimal point. Note that whenever such an ellipse exists, it always fits completely into the textbook page, i.e. all points (x, y) of the ellipse satisfy inequalities |x|, |y| <= 1 000.

Sample Input

3
5 0 0 5 4 3 3 4 -4 -3
6 1 3 2 -2 -3 -3 -2 1 6
7 -3 2 7 6 3 5 5 -2 -9

Sample Output

78.539816
IMPOSSIBLE
157.079633

Source

Northeastern Europe 2004, Northern Subregion

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator