Given n segments in the plane (represented by a pair of coordinates), give the number of triangles formed by the intersections of the segments. Three colinear points do not form a triangle.
Input
Every segment has and integer beginning point and endpoint, between -10 and 10. There are N cases.
- 10 ≤ n ≤ 640
- 600 ≤ N ≤ 3000
Examples
Input :
-3 1 7 0
0 -2 3 -7
-7 4 6 1
6 -2 -7 7
7 -9 3 2
-10 0 -10 8
-9 1 3 -5
9 7 3 2
-2 -1 -10 10
-5 0 -1 -8
2 -2 0 -9
-9 5 10 1
9 -9 -1 8
Output :
9
Input :
-7 5 3 10
-8 5 -2 -10
-4 0 0 -9
9 9 8 -8
9 -4 0 -6
7 3 2 -9
-8 10 -8 6
-6 6 -9 2
7 2 6 -9
-6 8 -7 -10
-7 -2 -2 -10
8 -8 6 1
Output :
6
Input :
6 -6 5 -5
8 -9 0 -6
9 -3 9 -7
-4 -1 2 -10
5 -10 -9 2
-2 -9 5 8
3 6 -1 -10
8 9 3 -9
8 -3 -5 -2
-6 -9 -6 2
-6 -7 -6 5
-2 -5 0 2
10 3 -3 -10
Output :
31