There is a long road of length $$$10^{9}$$$.
There are $$$N$$$ pedestrians crossing the road and $$$M$$$ cars driving on the road. You know, that the $$$i$$$-th pedestrian is going to cross the road from time $$$s_i$$$ to time $$$e_i$$$ at position $$$p_i$$$. You also know that the $$$j$$$-th car will drive from position $$$l_j$$$ to position $$$r_j$$$, starting at time $$$t_j$$$. To prevent car accidents, the following rule is set to regulate cars.
All the cars proceed $$$1$$$ unit of length per unit of time unless it is stopped by the regulation.
To better illustrate the idea, the action of the car is defined as below.
Given all the above information, you now wonder how many unordered pairs of cars would meet each other (formally speaking, there exists some time when the cars share the same position).
Below are some notes to avoid ambiguity, they are helpful but not necessary.
The first line of the input consists of two integers $$$N, M$$$, representing the number of pedestrians and cars.
Each of the following $$$N$$$ lines consists of three integers $$$s_i, e_i, p_i$$$, representing the starting time, ending time, and the position of the pedestrian's crossing.
Each of the following $$$M$$$ lines consists of three integers $$$l_j, r_j, t_j$$$, representing the starting position, ending position, and the starting time of the car.
It is guaranteed that all position given ($$$p_i, l_j, r_j$$$) are distinct.
Output a single line with the number of unordered pairs of cars which would meet each other.
1 2 1 10 5 3 7 1 4 8 1
1
1 3 1 10 5 2 7 2 4 8 1 1 3 1
2
In sample input 1, car 1 and car 2 meets at position 5, time 3.
In sample input 2, car 1 and car 3 meets at position 2, time 2; car 1 and car 2 meets at position 5, time 5.
| Name |
|---|


