#include <bits/stdc++.h>
// #define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
const int N = 1e6 + 10;
long long a[N], c[N];
int n, k;
int lowbit(int x) // 返回末尾的1
{
return x & -x;
}
void add(int x, int y)
{
for (int i = x; i < N; i += lowbit(i))
{
c[i] += y;
}
}
long long query(int x)
{
long long sum = 0;
for (int i = x; i; i -= lowbit(i))
{
sum += c[i];
}
return sum;
}
signed main()
{
// IOS;
scanf("%d%d", &n, &k);
for (int i = 1; i <= k; i ++ )
{
char op[2];
scanf("%s", op);
if (*op == 'A')
{
int m;
cin >> m;
cout << query(m) << endl;
}
else if (*op == 'B')
{
int x, y;
cin >> x >> y;
add(x, y);
}
else
{
int x, y;
cin >> x >> y;
add(x, -y);
}
}
return 0;
}