#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define INIT(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define S(d) scanf("%d",&d)
#define SLL(d) scanf("%lld",&d)
#define P(d) printf("%d\n",d)
#define PLL(d) printf("%lld\n",d)
using namespace std;
const int inf=0x3f3f3f3f;
const int N=2e5+7;
const int M=2e6+7;
const int mod=1e9+7;
ll c[N],a[N];
int n,m;
int lowbit(int x) {return x & -x;}
void add(int x,ll y){
for(;x<=n;x+=lowbit(x)) c[x]+=y;
}
ll query(int x){
ll ans=0;
for(;x;x-=lowbit(x)) ans+=c[x];
return ans;
}
int main(){
scanf("%d%d",&n,&m);
rep(i,1,n) SLL(a[i]);
int l,r,x; ll d; char c;
while(m--){
getchar();
scanf("%c",&c);
if(c=='Q'){
scanf("%d",&x);
printf("%lld\n",query(x)+a[x]);
}
else{
scanf("%d%d%lld",&l,&r,&d);
add(l,d);add(r+1,-d);
}
}
return 0;
}
线段树不香吗
香是香,但树状数组码量小啊/xk