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,P=998244353;

int n,q,v[N<<2],f[N<<2],tag[N<<2],a[N];
void pushup(int o){
	f[o]=(f[o<<1]+f[o<<1|1])%P;
}
void build(int l,int r,int o){
	tag[o]=0;
	if(l==r){
		v[o]=a[l];
		f[o]=v[o];
		return;
	}
	int mid=l+r>>1;
	build(l,mid,o<<1);
	build(mid+1,r,o<<1|1);
	v[o]=(v[o<<1]+v[o<<1|1])%P;
	f[o]=v[o];
}
void pushdown(int o){
	tag[o<<1]=tag[o];
	tag[o<<1|1]=tag[o];
	f[o<<1]=(1LL*v[o<<1]*tag[o])%P;
	f[o<<1|1]=(1LL*v[o<<1|1]*tag[o])%P;
	tag[o]=0;
	return;
}
void modify(int l,int r,int o,int ld,int rd,int d){
	if(l>=ld&&r<=rd){
		f[o]=(1LL*v[o]*d)%P;
		tag[o]=d;
		return;
	}
	if(tag[o])pushdown(o);
	int mid=l+r>>1;
	if(ld<=mid)modify(l,mid,o<<1,ld,rd,d);
	if(rd>mid) modify(mid+1,r,o<<1|1,ld,rd,d);
	pushup(o);
}
int main(){
	scanf("%d%d",&n,&q);
	a[n]=1;
	for(int i=n-1;i;i--)a[i]=(1LL*a[i+1]*10)%P;
	build(1,n,1);
	while(q--){
		int l,r,d;
		scanf("%d%d%d",&l,&r,&d);
		modify(1,n,1,l,r,d);
		printf("%d\n",f[1]);
	}
}