#include<bits/stdc++.h>
using namespace std;
long long n,w,ans=0;
char qwq;
int b,c;
long long pos[500002],sum[500002];
int fuck(long long awa) {
return awa&(-awa);
}
void xg(long long x,long long y) {
while(x<=y) {
pos[x]+=y;
x+=fuck(x);
}
return;
}
int cx(long long x,long long y) {
while(x>0) {
y+=pos[x];
x-=fuck(x);
}
return y;
}
int jfjf(long long xxx,long long yyy){
return cx(yyy,0)-cx(xxx-1,0);
}
signed main() {
scanf("%lld%lld",&n,&w) ;
for(int i=1; i<=w ; i++) {
cin>>qwq>>b>>c;
if(qwq == 'x') {
xg(b,c);
} else if(qwq == 'y') {
ans++;
sum[ans]=jfjf(b,c);
}
}
for(int i=1;i<=ans;i++){
cout<<sum[i]<<endl;
}
return 0;
}