There are n red balls kept on the positive X axis, and m blue balls kept on the positive Y axis. You are given the positions of the balls. For each i from 1 to n, the i-th red ball has the coordinates (xi,0), where xi is a positive integer. For each i from 1 to m, the i-th blue ball has the coordinates (0,yi), where yi is a positive integer.
It is given that all xixi are distinct. Also, all yi are distinct.
At the time t=0, for each i from 1 to n, the ith red ball is thrown towards positive Y axis with a speed of ui( that is, with velocity vector (0,ui)). Simultaneously (at time t=0), for each i from 1 to m, the ith blue ball is thrown towards positive X axis with a speed of vi (that is, with velocity vector (vi,0)).
Two balls are said to collide if they are at the same position at the same time. When two balls collide, they disappear, and hence no longer collide with other balls. (See sample examples for clarification).
Find the total number of collisions the balls will have.
Input
First line contains n and m, the number of red balls, and the number of blue balls, respectively.
ith of the next n lines contains two space separated integers xi and ui, the position and speed of the ith red ball respectively
ith of the next m lines contains two space separated integers yi and vi, the position and speed of the ith blue ball respectively
Output
Print the number of collisions.
Constraints
1≤n,m≤105
1≤xi,ui,yi,vi≤109
for all 1≤i<j≤n,xi≠xj
for all 1≤i<j≤m,yi≠yj
Example Input 1
1 1
1 2
2 1
Example Output 1
1
Example Input 2
1 2
1 2
2 1
1 2
Example Output 2
1
Explanation
Example case 1: The balls collide at t = 1, at the coordinates (1, 2).
Example case 2: The red ball and the second blue ball collide at time 0.5 at coordinates (1, 1). Note that the first blue ball would have collided with the red ball at t = 1 (like in sample input # 1), if the second blue ball wasn’t present. But since the red ball disappears at t = 0.5, its collision with first blue ball doesn’t happen. The total number of collisions is 1.