Naruto was declared as the \(7^{th}\) Hokage because of his great contribution in the \(4^{th}\) Shinobi World War. As soon as he aquires office, he changes the process of ranking of Shinobis. Instead of the Genin (Beginner), Chuunin (Intermediate) and Jounin (Expert), the new ranks are numbers ranging from 1 (lowest) to \(10\) (highest).
There are a total of N ninjas in the Leaf Village, \(i^{th}\) of which has \(A_{i}\) amount of chakra (energy). A ninja with rank P would have a strength of \({A_{i}}^{P}\).
Naruto has Q pending tasks to perform which can be of one of the following types:-
Naruto asked you to take care of these tasks.
INPUT FORMAT
The first line of input contains a single integer T denoting the number of test cases.
The first line of each test case contains a single integer N denoting the number of ninjas in the Leaf Village.
The next line contains N space separated integers. \(i^{th}\) integer denotes the amount of chakra \(A_{i}\) in the \(i^{th}\) ninja.
The third line contains a single integer Q denoting the number of pending tasks that Naruto has.
This is followed by Q lines each containing the description of a task that Naruto has to perform.
OUTPUT FORMAT
The output should consist of the answer of all the queries of the \(3^{rd}\) type printed on a new line.
CONSTRAINTS
The \(1^{st}\) task is query - \(1^{3} + 5^{3} + 9^{3} = 855\).
The \(2^{nd}\) task is update after which the array becomes \(1\; 8\; 12\; 5\; 3\).
The \(3^{rd}\) task is query - \(1^{3} + 8^{3} + 12^{3} = 2241\).
The \(4^{th}\) task is update after which the array changes to \(1\; 12\; 12\; 5\; 3\).
The \(5^{th}\) task is query - \(1^{3} + 12^{3} + 12^{3} = 3457\).