Max has just started grade , and he is in his math class, learning equations of lines!
Max defines the slope-intercept form of a line as the equation of the line in the form . Max is given lines in slope-intercept form, each with a distinct and . Max wants to see, at some integer , the maximum possible value out of all the lines. He wants to test all integer values of in the range , and wants the sum of these values.
Not knowing how to do it, he has asked you to do it for him! Help him!
The first line will contain the integer , the number of lines.
The next lines will each contain two integers, . It is guaranteed both and are distinct.
On the first line, output the sum of the maximum possible values for every integer in the range . Note that 64-bit integers may be required to pass.
Subtask 1 [40%]
Subtask 2 [60%]
No further constraints.
Sample Input 1
3 4 2 -4 -6 0 -2
Sample Output 1
Sample Input 2
2 -1 1000 1 -1000
Sample Output 2