URI Online Judge | 2710

Game of Array

By Luciano Ribeiro, Inatel BR Brazil

Timelimit: 1

Dâmi and Marcus like to create computer games. Recently they created a game based in arrays, and now they need your help to test it.

It's given to you a bidimensional array M, which are initially filled with zeros. Then will be given Q operations. They are:

After they have created the game, now they want you to help them verify if their code is correct.

Input

Each test case will begin with an integer Q (Q ≤ 100 000). After this you must read Q operations in the format described above (1 ≤ X ≤ Z ≤ 500 e 1 ≤ Y ≤ ≤ 500  e |V| ≤ 5000).

Output

For each operation of type "A", print the corresponding value as shown in the output sample.

Input Sample Output Sample

6
U 2 2 5 6 2
U 3 4 8 5 1
A 4 3
A 3 5
A 7 5
A 1 1

2
3
1
0