#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
const long long maxn=500010;
int n, k;
inline void qread(int &x){
x = 0;
int ch = getchar();
while(ch < '0' || ch > '9') ch =getchar();
while(ch >='0' && ch <= '9') x = 10 * x + ch - 48, ch = getchar();
}
struct BItree{
int data[maxn];
BItree(){
memset(data, 0, sizeof(data));
}
void add(int x, int v){
for(; x <= n; x += (x&-x))
data[x] += v;
}
int sum(int x){
int ans = 0;
for(; x; x -= (x&-x))
ans += data[x];
return ans;
}
}bi;
int main(void)
{
qread(n);
qread(k);
while(k--){
string op;
cin >> op;
if(op == "A"){
int x;
qread(x);
printf("%d\n", bi.sum(x));
}
else if(op == "B"){
int x, y;
qread(x), qread(y);
bi.add(x, y);
}
else{
int x, y;
qread(x), qread(y);
bi.add(x, -y);
}
}
}