Beads

No attempts yetTime limit1sMemory limit256 MB

Problem

A game is played by putting beads into boxes. The full rules are too long to repeat here. Only one thing matters for the outcome: you have to keep track of how many beads sit in a run of adjacent boxes.

A friend asked you to write a program that helps him win every game. At the start of a game every box is empty.

Input

The first line contains TT, the number of games played. Each game begins with a line holding BB, PP and QQ: the number of boxes, the number of put requests, and the number of query requests.

Then follow P+QP + Q lines. Each line is either P i a, meaning aa beads are put into box ii, or Q i j, asking how many beads are in boxes ii through jj at that moment. Both end boxes belong to the range.

  • 0<T1000 < T \le 100
  • 0<B1000000 < B \le 100000
  • 0<P300000 < P \le 30000
  • 0<Q300000 < Q \le 30000
  • 0a1000 \le a \le 100
  • In P i a, 0<iB0 < i \le B.
  • In Q i j, 0<ijB0 < i \le j \le B.
  • Boxes are numbered from 1.
  • The input and the output are large. Read the input through a buffered reader and collect the whole output before writing it once.

Output

For each query request, print the total number of beads in boxes ii through jj at that point of the game, one number per line.