Plane geometry is an important branch of elementary mathematics. When Rikka was a middle school student, she learns a lot of theories about lines, triangles, and circles.
As the time goes on, Rikka has learned a lot of more profound knowledge of mathematics, but she finds that the tasks about lines, triangles, and circles appear less and less. Rikka loves plane geometry because it is simple enough even for a middle school student and is interesting: she misses them very much.
So, Rikka wants to come up with some tasks about lines for herself. She draws $n$ lines $y = a_ix+b_i$ on the two-dimensional Cartesian coordinate system. And then she gives a rectangle with the left bottom corner $(x_1,y_1)$ and the right top corner $(x_2,y_2)$. She wants to count the number of the line pairs $(i,j)(i <j)$ which satisfies their cross point (if exists) is inside the rectangle (including the boundary).
It is a simple task for Rikka, and she wants to test you. To show your mathematics skill, you need to solve this task as soon as possible.