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 N=2e5+5;
const int MOD=998244353;
int n,m=1,q;
int wt[N];
int lson[N*2],rson[N*2],val[N*2],tag[N*2],siz[N*2];

void selfupd(int pos){
	val[pos]=1ll*tag[pos]*siz[pos]%MOD;
}

void update(int pos){
	val[pos]=(val[lson[pos]]+val[rson[pos]])%MOD;
}

void build(int pos,int x,int y){
	if(x==y){
		siz[pos]=val[pos]=wt[x];
		return;
	}
	int mid=(x+y)>>1;
	lson[pos]=++m;
	rson[pos]=++m;
	build(lson[pos],x,mid);
	build(rson[pos],mid+1,y);
	siz[pos]=(siz[lson[pos]]+siz[rson[pos]])%MOD;
	update(pos);
}

void pushdown(int pos){
	if(tag[pos]){
		tag[lson[pos]]=tag[pos];
		tag[rson[pos]]=tag[pos];
		tag[pos]=0;
		selfupd(lson[pos]);
		selfupd(rson[pos]);
	}
}

void modify(int pos,int x,int y,int l,int r,int v){
	if(x>=l&&y<=r){
		tag[pos]=v;
		selfupd(pos);
		return;
	}
	if(x>r||y<l) return;
	int mid=(x+y)>>1;
	pushdown(pos);
	modify(lson[pos],x,mid,l,r,v);
	modify(rson[pos],mid+1,y,l,r,v);
	update(pos);
}

int main(){
	scanf("%d%d",&n,&q);
	wt[n]=1;
	for(int i=n-1;i>=1;i--) wt[i]=10ll*wt[i+1]%MOD;
	build(1,1,n);
	while(q--){
		int l,r,v;
		scanf("%d%d%d",&l,&r,&v);
		modify(1,1,n,l,r,v);
		printf("%d\n",val[1]);
	}
	return 0;
}