Curious Robin Hood

2 seconds
128 MB
Easy
LOJ-1112 Udebug Debug
English

Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another trick. He keeps n sacks where he keeps this money. The sacks are numbered from 0 to n-1.

Now each time he can he can do one of the three following tasks:

  1. Give all the money of the ith sack to the poor, leaving the sack empty.
  2. Add new amount (given in input) in the ith sack.
  3. Find the total amount of money from ith sack to jth sack.

Since he is not a programmer, he seeks your help.

Input

Input starts with an integer T (≤ 5), denoting the number of test cases.

Each case contains two integers n (1 ≤ n ≤ 105) and q (1 ≤ q ≤ 50000). The next line contains n space separated integers in the range [0, 1000]. The ith integer denotes the initial amount of money in the ith sack (0 ≤ i < n).

Each of the next q lines contains a task in one of the following form:

  • 1 i - give all the money of the ith.
  • 2 i v - add money v (1 ≤ v ≤ 1000) to the ith (0 ≤ i < n) sack.
  • 3 i j - find the total amount of money from the ith sack to the jth sack (0 ≤ i ≤ j < n).

Output

For each test case, print the case number first. If the query type is 1, then print the amount of money given to the poor. If the query type is 3, print the total amount from ith to jth sack.

Sample

Sample Input Sample Output

1 5 6 3 2 1 4 5 1 4 2 3 4 3 0 3 1 2 3 0 4 1 1

Case 1: 5 14 1 13 2

Notes

Dataset is huge, use faster I/O methods.