Alice and Bob, after played enough and completely figured out the game
with colored strip, decided to ride bikes around the fountain on a
circular path of length L. Alice rides with a speed v_{A},
Bob — with a speed v_{B}, and they have started in different
directions. At the initial moment the kids were in the same point. When they
“meet” (i.e., at some moment they are in the same point as in the
previous were not), they joyfully exclaim (“Oh, Bob!” or “Oh, Alice!”
respectively). But sometimes along the way, the kids stop to feed the
squirrels. Find, how many times Alice and Bob “have met”.
Input
The first line contains integers L, T, v_{A}, and v_{B} that are the
length of the path, the riding time and the speed of Alice and Bob,
respectively (1 ≤ L ≤ 10^{9}; 1 ≤ T ≤ 10^{6}; 1 ≤ v_{A},v_{B}
≤ 10^{3}).
The next line contains a single integer n, that is the number of
intervals in which children were feeding squirrels (0 ≤ n ≤ 10^{5}).
The next n lines describe those intervals. Each description consists of
three integers: type_{i} t_{i} d_{i}, meaning who was feeding (1 for
Alice and 2 for Bob), at what moment the feeding started and how much time
it lasted, respectively (0 ≤ t_{i}, d_{i} ≤ T; t_{i} + d_{i} ≤
T).
It is guaranteed that for one kid any two intervals intersect in no more than one point.
The intervals are given in order of nondecreasing t_{i}.
Output
Output the number of “meetings” of Alice and Bob.
Sample
input  output 

10 10 2 1
3
1 1 1
1 2 2
2 2 1
 2

Problem Author: Nikita Sivukhin
Problem Source: Ural FU Junior Championship 2016