#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,tree[1000010];
ll lowbit(ll k) {
return k & -k;
}
void add(ll x,ll k) {
while(x<=n) {
tree[x]+=k;
x+=lowbit(x);
}
}
ll sum(ll x) {
ll ans=0;
while(x!=0) {
ans+=tree[x];
x-=lowbit(x);
}
return ans;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("P2068 统计和.in","r",stdin);
// freopen("P2068 统计和.out","w",stdout);
cin>>n>>m;
for(ll i=1; i<=n; i++) {
tree[i]=0;
}
for(ll i=1; i<=m; i++) {
ll b,c;
char a;
cin>>a>>b>>c;
if(a=='x')
add(b,c);
if(a=='y')
cout<<sum(c)-sum(b-1)<<"\n";
}
}