In the Clouds
In the "Surreal" game engine, clouds are generated as convex polyhedra with triangular faces. For example, an octohedron has 8 triangular faces:
Given the points that make up each face of a cloud, what is its volume?
Input
The first line consists of an integer
, the number of faces on the cloud.
The next lines contain 3 points on the cloud, in the form
,
,
, representing a face of the cloud.
Note: Each cloud is guaranteed to be a complete, convex 3D polygon made of triangular faces.
Output
Output the volume of the cloud, in units3, to 4 decimal places.
Example
Input
8
2 1 1 1 2 1 1 1 2
2 1 1 1 0 1 1 1 2
0 1 1 1 2 1 1 1 2
0 1 1 1 0 1 1 1 2
2 1 1 1 2 1 1 1 0
2 1 1 1 0 1 1 1 0
0 1 1 1 2 1 1 1 0
0 1 1 1 0 1 1 1 0
Output
1.3333
The octohedron shown above has an area of 1.3333 units3.
Comments