#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> arb;
vector<int> lazy;
void create(int l,int r,int pos){
if(l==r){
arb[pos] = 1;
return;
}
int mid = (l+r)/2;
create(l,mid,pos*2);
create(mid+1,r,pos*2+1);
arb[pos] = arb[pos*2] + arb[pos*2+1];
}
void lazyCheck(int l,int r,int pos){
if(lazy[pos]!=0){
arb[pos] = (r-l+1) * lazy[pos];
if(l!=r){
lazy[pos*2] += lazy[pos];
lazy[pos*2+1] += lazy[pos];
}
lazy[pos] = 0;
}
}
void update(int l,int r,int fl,int fr,int pos,int val){
lazyCheck(l,r,pos);
if(l>=fl and r<=fr){
arb[pos] = (r-l+1)*val;
if(l!=r){
lazy[pos*2] += val;
lazy[pos*2+1] += val;
}
return;
}
int mid = (l+r)/2;
update(l,mid,fl,fr,pos*2,val);
update(mid+1,r,fl,fr,pos*2+1,val);
arb[pos] = arb[pos*2] + arb[pos*2+1];
}
int main() {
cin>>n>>m;
arb.resize(n*2,0);
lazy.resize(n*2,0);
create(0,n,0);
for(int i=1;i<=m;i++){
int c;
cin>>c;
if(c==1 or c==2){
int x,nr;
cin>>x>>nr;
if(c==1)
upd(0,n,pos,x,x+nr,-1);
else
upd(0,n,pos,x,x+nr,1);
}
}
}