Matrix Summation
A n × n matrix is filled with numbers. BuggyD is analyzing the matrix, and he wants the sum of certain submatrices every now and then, so he wants a system where he can get his results from a query. Also, the matrix is dynamic, and the value of any cell can be changed with a command in such a system.
Assume that initially, all the cells of the matrix are filled with 0.
Input
The first line contains the number of test cases t.
The first line of each test case contains a single integer n (1 ≤ n ≤ 1024), denoting the size of the matrix.
A list of commands follows, which will be in one of the following three formats (quotes are for clarity):
"SET x y num" - Set the value at cell (x, y) to num (0 ≤ x, y < n).
"SUM x1 y1 x2 y2" - Find and print the sum of the values in the rectangle from (x1, y1) to (x2, y2), inclusive. You may assume that x1 ≤ x2 and y1 ≤ y2, and that the result will fit in a signed 64-bit integer.
"END" - Indicates the end of the test case.
Output
For each test case, output one line for the answer to each "SUM" command. Print a blank line after each test case.