DeviantArt
The art of photography is another Ira's hobby. Her works occupy a worthy place on the pages of DeviantArt. Every Internet user can freely go to her gallery and "Like" image(s) he liked, increasing rating of those image(s) by 1.
— Mmm! Not a bad job for a bot.
The essence of the bot consisted in the following: a specially created user "Likes" K photos, starting with I-th, in increments of A. The second bot was created to monitor results. It checks the sum of ratings for L pictures, starting with J-th, in increments of B. Photographs are numbered from 0.
Bots work independently until the administration of DeviantArt will notice the cheating with "Likes" and bans both Anonymouses.
Input
First line of input file contains four integers N (1 ≤ N ≤ 10^5), A (1 ≤ A ≤ N), B (1 ≤ B ≤ N) and Q (0 ≤ Q ≤ 10^5) — number of pictures, size of steps for bots that do not change throughout their lives, and the total number of iterations, respectively. Then in each of Q of lines written a command for a bot:
s I K — first bot "Likes" K (1 ≤ K ≤ N, I+(K-1)A ≤ N-1) pictures, starting from I-th (0 ≤ I ≤ N-1). g J L — second bot counts rating of L (1 ≤ L ≤ N, J+(L-1)B ≤ N-1) pictures, starting from J-th (0 ≤ J ≤ N-1).
Before bots started their actions, all pictures had rating 0.
Output
In a separate line print a result for each command for second bot.