Problem: Ghosts live in harmony and peace, they travel the space without any purpose other than scare whoever stands in their way.
There are ghosts in the universe, they move in the plane, each one of them has its own velocity that does not change in time: where is its speed on the -axis and is on the -axis.
A ghost has experience value , which represent how many ghosts tried to scare him in his past. Two ghosts scare each other if they were in the same cartesian point at a moment of time.
As the ghosts move with constant speed, after some moment of time there will be no further scaring (what a relief!) and the experience of ghost kind will never increase.
Tameem is a red giant, he took a picture of the cartesian plane at a certain moment of time , and magically all the ghosts were aligned on a line of the form . You have to compute what will be the experience index of the ghost kind in the indefinite future, this is your task for today.
Note that when Tameem took the picture, may already be greater than , because many ghosts may have scared one another at any moment between .
Input Format: The first line contains three integers , and (, , ) — the number of ghosts in the universe and the parameters of the straight line.
Each of the next lines contains three integers , , (, ), where is the current -coordinate of the -th ghost (and ).
It is guaranteed that no two ghosts share the same initial position, in other words, it is guaranteed that for all for .
Output Format: Output one line: experience index of the ghost kind in the indefinite future.
Note: There are four collisions , , , , where means a collision happened between ghosts and at moment . At each collision, each ghost gained one experience point, this means that .
In the second test, all points will collide when .
The red arrow represents the 1-st ghost velocity, orange represents the 2-nd ghost velocity, and blue represents the 3-rd ghost velocity.