# Include <iostream> # include <cstdio> # include <cstring> # define n 50000 using namespace STD; struct node {int L, R; long sum ;}; node tree [N * 3]; void buildtree (int l, int R, int POS) {tree [POS]. L = L; tree [POS]. R = r; If (L = r) {scanf ("% i64d", & tree [POS]. sum); return;} int mid = (L + r)> 1; buildtree (L, mid, POS * 2); buildtree (Mid + 1, R, pos * 2 + 1); tree [POS]. sum = tree [POS * 2]. sum + tree [POS * 2 + 1]. SUM;} long query (int l, int R, int POS) {If (L = tree [POS]. L & R = tree [POS]. r) return tree [POS]. SUM; else if (r <= (tree [POS]. L + tree [POS]. r)/2) return query (L, R, POS <1); else if (L> = (tree [POS]. L + tree [POS]. r)/2 + 1) return query (L, R, (Pos <1) + 1); elsereturn query (L, tree [POS * 2]. r, POS * 2) + query (tree [POS * 2 + 1]. l, R, POS * 2 + 1);} void Update (INT POs, int K, int add) {If (k> = tree [POS]. L & K <= tree [POS]. r) {tree [POS]. sum + = add; If (tree [POS]. L = tree [POS]. r) return; Update (Pos * 2, K, add); Update (Pos * 2 + 1, K, add) ;}return ;} int main () {int T; scanf ("% d", & T); int CAS = 1; while (t --) {int N; scanf ("% d", & N); int I; printf ("case % d: \ n", CAS ++); buildtree (1, n, 1); While (1) {char STR [20]; scanf ("% s", STR); If (STR [0] = 'E') break; else if (STR [0] = 'q ') {int T1, T2; scanf ("% d", & T1, & T2); printf ("% i64d \ n", query (T1, T2, 1);} else if (STR [0] ='s ') {int T1, T2; scanf ("% d", & T1, & T2 ); update (1, T1,-t2);} else if (STR [0] = 'A') {int T1, T2; scanf ("% d ", & T1, & T2); Update (1, T1, T2 );}}}}