In The Clouds

View as PDF

Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type

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 N (1 \leq N \leq 10^5), the number of faces on the cloud.

The next N lines contain 3 points on the cloud, in the form X_1 Y_1 Z_1, X_2 Y_2 Z_2, X_3 Y_3 Z_3, representing a face of the cloud. (0 \leq X, Y, Z \leq 10^8)

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

There are no comments at the moment.