code:
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a[555555];
int n,m;
#define lowbit(x) (x&(-x))
void add(int x,ll y){
while(x<=n){
a[x]+=y;
x+=lowbit(x);
}
}
ll query(int x){
ll ans=0;
while(x){
ans+=a[x];
x-=lowbit(x);
}
return ans;
}
int main(){
cin>>n>>m;
int op,l,r;ll x;
for(int i=1;i<=m;i++){
cin>>op;
if(op==1){
cin>>l>>r>>x;
add(l,x);
add(r+1,-x);
}
else if(op==2){
cin>>op;
cout<<query(op)<<endl;
}
}
}
WA 100%