Polygon Puzzler 

We define a simple polygon as an area enclosed by endpoint-connected line segments such that no line segment intersects another (except for adjoining segments at their endpoints). A simple polygon can thus be defined by an ordered list of its vertices (the endpoints of the enclosing line segments). A planar polygon is a polygon whose vertices all lie in the same plane.

For this problem you are asked to compute the area of a simple planar polygon oriented in three space. That is, although the vertices of the polygon lie in some two-dimensional plane, the vertices are specified in three-dimensional Cartesian coordinates.

Input 

The input will consist of several data sets. The first line of the data set will cointain the number of vertex of the polygon. Then an ordered sequence of coordinates for the vertices of the polygon follow. Each vertex will be in a line, and it will contain the three-dimensional cartesian coordinates for the single vertex in the order x, y, z. The values for the x, y, z components will be separated by a single space. Input values should be considered to be double precision floating point and may be positive or negative. No polygon will have less than 3 or more than 1024 vertices. Input will finish with a polygon with 0 vertices. This test case shouldn't be processed.

Output 

The output should be the area of the polygons specified by the input and should be rounded to the nearest 1/1000 (i.e., three places after the decimal point should be printed).

Sample Input 

4
-1.401117996399998e+00 1.509291958378880e-01 1.186959898555237e-01
1.918738650437130e-01 1.067473024933127e+00 9.075713530920345e-01
1.401117996399998e+00 -1.509291958378880e-01 -1.186959898555237e-01
-1.918738650437130e-01 -1.067473024933127e+00 -9.075713530920345e-01
4
0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
0

Sample Output 

4.000
1.000



Miguel A. Revilla
1998-03-10