#include <bits/stdc++.h>
using namespace std;
int n;
long long c[100010];
int lowb(int x)
{
return x & -x;
}
long long getsum(int x)
{
long long sum=0;
while(x>0)
{
sum+=c[x];
x-=lowb(x);
}
return sum;
}
void chang(int a,int b)
{
while(a<=n)
{
c[a]+=b;
a+=lowb(a);
}
}
int main()
{
int a[100010];
int m;
freopen("shulieb.in","r",stdin);
freopen("shulieb.out","w",stdout);
cin>>n;
a[0]=0;
for (int i=1;i<=n;i++) {
cin>>a[i];
chang(i,a[i]-a[i-1]);
}
cin>>m;
string s;
int x,y,k;
for (int i=1;i<=m;i++)
{
cin>>s;
if (s=="QUERY"){
cin>>x;
cout<<getsum(x)<<endl;
}
else {
cin>>x>>y>>k;
chang(x,k);
chang(y+1,-k);
}
}
return 0;
}