#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
#define IT set<node>::iterator
using namespace std ;
int n , q , sum ;
struct node {
int l , r ;
mutable int v ;
node (int L , int R = -1 , int V = 0) : l(L) , r(R) , v(V) {}
bool operator < (const node &a) const {return l < a.l ;}
} ;
set <node> s ;
IT split (int pos) {
IT it = s.lower_bound (node (pos)) ;
if (it != s.end () && it -> l == pos) return it ;
it-- ;
int L = it -> l , R = it -> r ;
int V = it -> v ;
s.erase (it) ;
s.insert (node (L , pos - 1 , V)) ;
return s.insert (node (pos , R , V)).first ;
}
void assign (int l , int r , int k) {
IT itl = split (l) , itr = split (r + 1) ;
for (IT it = itl ; it != itr ; it++)
sum -= (it -> r - it -> l + 1) * (it -> v) ;
s.erase (itl , itr) ;
s.insert (node (l , r , k)) ;
sum += k * (r - l + 1) ;
}
int main () {
scanf ("%d %d" , &n , &q) ;
sum = n ;
s.insert (node (1 , n , 1)) ;
while (q--) {
int opt , l , r ;
scanf ("%d %d %d" , &l , &r , &opt) ;
if (opt == 1) assign (l , r , 0) ;
else assign (l , r , 1) ;
printf ("%d\n" , sum) ;
}
return 0 ;
}