#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
//#define MOD 1000000007
#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

vector<ll> ten,eleven,level;

long long power(long long b,long long e){
  long long r=1;
  while(e){
      if(e&1){
          r=(r*b)%MOD;
      }
      b=(b*b)%MOD;
      e >>=1;
  }
  return r;
}

class segmenttree_lazy{
    
    private:
    int n=0;
    long long identity = 0;//単位元
    std::vector<long long> dat;
    std::vector<long long> lazy;
    std::vector<bool> lazy_flag;
    public:
    
    void init(int N){
        n=1;
        while(n<N)n*=2;
        dat.clear();
        for(int i=0;i<2*n-1;++i){
            dat.push_back(identity);
            lazy.push_back(identity);
            lazy_flag.push_back(false);
        }
    }
    
    long long prosess();
    long long prosess2();
    long long calc();
    
    void eval(int k,long long l,long long r){
        if(!lazy_flag[k])return;
        dat[k] = prosess2(dat[k],lazy[k],k);
        if(r-l>1){
            lazy[2*k+1] = prosess(lazy[2*k+1],lazy[k]);
            lazy[2*k+2] = prosess(lazy[2*k+2],lazy[k]);
            lazy_flag[2*k+1] = lazy_flag[2*k+2] = true;
        }
        lazy_flag[k]=false;
        lazy[k]=identity;
    }
    
    void update(int a,int b,long long val,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        
        eval(k,l,r);
        
        if(r<=a || b<=l)return;
        if(a<=l && r<=b){
            lazy[k] = prosess(lazy[k],val);
            lazy_flag[k] = true;
            eval(k,l,r);
        }else{
            update(a,b,val,2*k+1,l,(l+r)/2);
            update(a,b,val,2*k+2,(l+r)/2,r);
            dat[k] = calc(dat[2*k+1],dat[2*k+2],k);
        }
        
        
    }
    
    long long query(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        eval(k,l,r);
        if(r<=a || b<=l)return identity;
        if(a<=l && r<=b)return dat[k];
        
        long long ql = query(a,b,2*k+1,l,(l+r)/2);
        long long qr = query(a,b,2*k+2,(l+r)/2,r);
        
        //if(k==0){for(ll i =n-1;i<2*n-1;i++){cout << dat[i] << " ";}cout << endl;}
        //if(k==0){for(ll i =n-1;i<2*n-1;i++){cout << lazy[i] << " ";}cout << endl;}
        
        //if(k==0){for(ll i =0;i<n-1;i++){cout << dat[i] << " ";}cout << endl;}
        
        return calc(ql,qr,k);
    }
    
    long long prosess(long long old,long long add){
        //your updating-prosess here
        return add;
    }
    
    long long prosess2(long long old,long long add,long long k){
        //your updating-prosess here
        ll p = (eleven[level[k]]*add)%MOD;
        return p;
    }
    
    long long calc(long long a,long long b,long long k){
        //your monoid here
        return ((ten[level[k]]*a)%MOD + b)%MOD;
    }
    
};

int main(void){
    
    ll N,Q;
    ll l,r,d;
    vector<pair<pair<ll,ll>,ll>> D;
    
    cin >> N >> Q;
    REP(i,Q){
        cin >> l >> r >> d;
        l--;r--;
        D.push_back({{l,r},d});
    }
    
    ten.push_back(1);
    ten.push_back(10);
    REP(i,N+2){
        ll now = ten.back();
        ten.push_back((now*now)%MOD);
    }
    
    eleven.push_back(1);
    eleven.push_back(11);
    REP(i,N){
        ll now = eleven.back();
        eleven.push_back(((now*ten[i+2])%MOD+now)%MOD);
    }
    
    ll ten_inv = power(10,MOD-2);
    ll diff=1;while(diff<N)diff*=2;diff-=N;
    ll ten_pr = power(ten_inv,diff);
    
    ll n=1,k=0;
    level.push_back(k);
    while(n<N){
        n*=2;k--;
        REP(i,n){level.push_back(k);}
    }
    REP(i,level.size()){level[i]-=(level.back());}
    //REP(i,level.size()){cout << ten[level[i]] << " ";}cout << endl;
    //REP(i,eleven.size()){cout << eleven[i] << " ";}cout << endl;
    
    segmenttree_lazy seg;
    seg.init(N);
    REP(i,N){seg.update(0,N,1);}
    REP(i,Q){
        l = D[i].first.first,r = D[i].first.second,d = D[i].second;
        r++;
        seg.update(l,r,d);
        ll Ans = seg.query(0,N);
        Ans = (Ans*ten_pr)%MOD;
        cout << Ans << endl;
    }
    
    return 0;
}



Measured memory_bytes: 30648