#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
const int maxn=5*1e4+5;
int C[maxn];
int lowbit(int x)
{
return (x&(-x));
}
void updata(int x,int y,int n)
{
for(int i=x;i<=n;i+=lowbit(i))
{
C[i]+=y;
}
}
int getsum(int x)
{ int ans=0;
while(x)
{
ans+=C[x];
x-=lowbit(x);
}
return ans;
}
int main(){
int T;
cin>>T;
while(T--)
{
int n;
cin>>n;
memset(C,0,(n+1)<<2);
for(int i=1;i<=n;i++)
{ int A;
cin>>A;
updata(i,A,n);
}
string s;
while(1){
cin>>s;
if(s[0]=='E') break;
else if(s[0]=='Q')
{
int x,y;
cin>>x>>y;
cout<<getsum(y)-getsum(x-1)<<endl;
}
else if(s[0]=='A')
{
int x,y;
cin>>x>>y;
updata(x,y,n);
}
else {
int x,y;
cin>>x>>y;
updata(x,-y,n);
}
}
}
return 0;
}