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>
using namespace std;
const int MOD=998244353;
int n,cnt;
int lzy[2000004];
int dat[2000004],L[2000004],R[2000004];
int q,pow0[200004],sp[200004];
int built(int l,int r){
	int id=++cnt;
	if(l<r)L[id]=built(l,(l+r)/2),R[id]=built((l+r)/2+1,r);
	return id;
}
void push(int id,int x,int len){
	lzy[id]=x;
	dat[id]=1ll*x*sp[len]%MOD;
}
void upd(int l,int r,int id,int a,int b,int x){
	if(r<a||b<l)return;
	if(a<=l&&r<=b){
		push(id,x,r-l);
		return;
	}
	if(lzy[id]>0)push(L[id],lzy[id],(l+r)/2-l),push(R[id],lzy[id],r-(l+r)/2-1),lzy[id]=0;
	upd(l,(l+r)/2,L[id],a,b,x),upd((l+r)/2+1,r,R[id],a,b,x);
	dat[id]=(1ll*dat[L[id]]*pow0[r-(l+r)/2]%MOD+dat[R[id]])%MOD;
}
int main(){
	pow0[0]=1,sp[0]=1;
	for(int i=1;i<200004;i++)pow0[i]=1ll*pow0[i-1]*10%MOD,sp[i]=(sp[i-1]+pow0[i])%MOD;
	cin>>n>>q;
	built(1,n);
	upd(1,n,1,1,n,1);
	while(q--){
		int l,r,d;cin>>l>>r>>d;
		upd(1,n,1,l,r,d);
		cout<<dat[1]<<"\n";
	}
}