Problem: You have a string S of length N. Initially, all characters in S are `1`s.

You will perform queries Q times. In the i-th query, you are given two integers L_i, R_i and a character D_i (which is a digit). Then, you must replace all characters from the L_i-th to the R_i-th (inclusive) with D_i.

After each query, read the string S as a decimal integer, and print its value modulo 998,244,353.

Constraints

* 1 \leq N, Q \leq 200,000
* 1 \leq L_i \leq R_i \leq N
* 1 \leq D_i \leq 9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N Q
L_1 R_1 D_1
:
L_Q R_Q D_Q


Output

Print Q lines. In the i-th line print the value of S after the i-th query, modulo 998,244,353.

Examples

Input

8 5
3 6 2
1 4 7
3 8 3
2 2 2
4 5 1


Output

11222211
77772211
77333333
72333333
72311333


Input

200000 1
123 456 7


Output

641437905

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define rp1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define rp0(i,n) for ((i)=0;(i)<(n);(i)++)
using namespace std;
const int mod=998244353;
int n,q,f[800005],tag[800005],s[800005],lst=1;
void build(int x,int l,int r){
	tag[x]=0;if(l==r){
		f[x]=s[x]=lst;lst=10ll*lst%mod;
		return;
	}
	int mid=(l+r)/2;build(x+x+1,mid+1,r);build(x+x,l,mid);
	s[x]=f[x]=(f[x+x]+f[x+x+1])%mod;
}
void update(int x,int l,int r,int ll,int rr,int c){
	if(ll<=l&&r<=rr){
		tag[x]=c;s[x]=1ll*f[x]*c%mod;
		return;
	}
	if(tag[x]){
		tag[x+x]=tag[x+x+1]=tag[x];
		s[x+x]=1ll*f[x+x]*tag[x]%mod;
		s[x+x+1]=1ll*f[x+x+1]*tag[x]%mod;
		tag[x]=0;
	}
	int mid=(l+r)/2;
	if(ll<=mid)update(x+x,l,mid,ll,rr,c);
	if(rr>mid) update(x+x+1,mid+1,r,ll,rr,c);
	s[x]=(s[x+x]+s[x+x+1])%mod; 
}
int main(){
	cin>>n>>q;int i;
	build(1,1,n);
	rp0(i,q){
		int l,r,d;
		cin>>l>>r>>d;update(1,1,n,l,r,d);
		cout<<s[1]<<endl;
	}
	return 0;
}