A situation similar to the one described in problem DeviantArt has arisen on the MySpace website.
Briefly, two bots were assigned to increase the ratings of photos. Due to the complexity of the site interface, or simply out of laziness, their tasks were somewhat simplified. The first bot increases the rating by for all photos with numbers such that K \bmod A = I. The second bot calculates the total rating of all photos with numbers such that L \bmod B = J. Photos are numbered starting from .
The first line contains four integers , , , and (1 \leq N \leq 10^5, 1 \leq A \leq N, 1 \leq B \leq N, 0 \leq Q \leq 10^5) — the number of photos, the step values for the bots (which remain unchanged), and the total number of operations, respectively. Each of the following lines contains a command for the bots:
s — the first bot increases the ratings of photos , I+A, I+2A, I+3A, ... (0 \leq I < A).
g — the second bot sums the ratings of photos , J+B, J+2B, J+3B, ... (0 \leq J < B).
Initially, all photos have a rating of .
For each command of the second bot, output its result on a separate line.
Example 1