is wondering how many times the lines cross each other. Since there are way too many lines for to count, he calls you in desperation.
Each line is represented in slope-intercept form, where you are given both the slope and the y-intercept (
Note that if there are multiple lines that cross each other at the exact same point, please count the pairs of lines that intersect at that point. More specifically, if
If 2 lines are congruent (with the same slope and y-intercept), print Infinity
(since 2 congruent lines intersect at an infinite number of points).
Constraints
Subtask 1 [90%]
Subtask 2 [10%]
Input Specification
The first line contains an integer
On each of the following
Output Specification
On the first line output the number of pairs of lines that intersect.
Note: It is recommended to use 64-bit integers when computing the answer.
Sample Input
3
1 1
1 -1
-1 3
Sample Output
2
Explanation for Sample Output
The 3 lines intersect at
Comments
What does (N 2) mean...?
It means "N choose 2", which is equal to