#P3476. Sum of Triangle Areas

    ID: 16731 Type: Default 1000ms 256MiB

Sum of Triangle Areas

Sum of Triangle Areas

Given n pairwise disjoint points in the plane (with \( n \ge 3 \)), there are \( \frac{n(n-1)(n-2)}{6} \) triangles that can be formed (including degenerate triangles, whose area is zero because the points are collinear). The task is to compute the sum of the areas of all these triangles. If a region of the plane is covered by several triangles, its area will be counted multiple times.

inputFormat

The first line of the input contains a single integer n (\( n \ge 3 \)), representing the number of points. Each of the following n lines contains two numbers separated by spaces, representing the \( x \) and \( y \) coordinates of a point in the plane.

outputFormat

Output a single floating-point number, which is the sum of the areas of all triangles formed by any three distinct points. The area of degenerate triangles (with collinear points) is considered as zero.

sample

3
0 0
1 0
0 1
0.5