E. Triangles 3000
time limit per test
5 seconds
memory limit per test
512 megabytes
standard input
standard output

You are given a set L = {l1, l2, ..., ln} of n pairwise non-parallel lines on the Euclidean plane. The i-th line is given by an equation in the form of aix + biy = ci. L doesn't contain three lines coming through the same point.

A subset of three distinct lines is chosen equiprobably. Determine the expected value of the area of the triangle formed by the three lines.


The first line of the input contains integer n (3 ≤ n ≤ 3000).

Each of the next lines contains three integers ai, bi, ci ( - 100 ≤ ai, bi ≤ 100, ai2 + bi2 > 0,  - 10 000 ≤ ci ≤ 10 000) — the coefficients defining the i-th line.

It is guaranteed that no two lines are parallel. Besides, any two lines intersect at angle at least 10 - 4 radians.

If we assume that I is a set of points of pairwise intersection of the lines (i. e. ), then for any point it is true that the coordinates of a do not exceed 106 by their absolute values. Also, for any two distinct points the distance between a and b is no less than 10 - 5.


Print a single real number equal to the sought expected value. Your answer will be checked with the absolute or relative error 10 - 4.

1 0 0
0 1 0
1 1 2
-1 1 -1

A sample from the statement is shown below. There are four triangles on the plane, their areas are 0.25, 0.5, 2, 2.25.