# Include <iostream> # include <cstdio> # include <cstring> using namespace std; struct node {int l; // left start point int r; // right end point int sum; // interval data sum}; node p [200004]; int a [50001]; int n; void bicould (int k, int l, int r) // create {int mid; p [k]. l = l; p [k]. r = r; if (l = r) {p [k]. sum = a [l]; return;} mid = (l + r)/2; biwould (k * 2, l, mid); biwould (k * 2 + 1, mid + 1, r); p [k]. sum = p [k * 2]. sum + p [k * 2 + 1]. sum; return;} int find (int k, int l, int r) // The value of the search interval {int mid; if (p [k]. l = l & p [k]. r = r) // locate the {return p [k] range. sum;} mid = (p [k]. l + p [k]. r)/2; if (l> mid) // right child in the midpoint {return find (k * 2 + 1, l, r );} if (r <= mid) // click the left child {return find (k * 2, l, r);} return find (k * 2, l, mid) + find (k * 2 + 1, mid + 1, r);} void update (int k, int x, int y) // update data {int mid; if (p [k]. l = x & p [k]. r = x) // if this point is found {p [k]. sum = y; // update data return;} mid = (p [k]. l + p [k]. r)/2; if (x <= mid) {update (k * 2, x, y);} else {update (k * 2 + 1, x, y);} p [k]. sum = p [k * 2]. sum + p [k * 2 + 1]. sum; return;} int main () {int t, I, k, x, y, m; char cz [7]; scanf ("% d", & t ); k = 0; while (t --) {k ++; scanf ("% d", & n); for (I = 1; I <= n; I ++) {scanf ("% d", & a [I]);} biwould (, n); printf ("Case % d: \ n", k ); while (1) {scanf ("% s", & cz); if (cz [0] = 'E') {break ;} scanf ("% d", & x, & y); switch (cz [0]) {case 'q': {printf ("% d \ n ", find (1, x, y); break;} case 'A': {A [x] + = y; m = a [x]; update (1, x, m); break;} case's ': {a [x]-= y; m = a [x]; update (1, x, m );}}}} return 0 ;}