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<iostream>
#include<cstdio>
using namespace std;
struct data{
	long long s,la,sz,p;
}t[1000001];
long long n,m,x,y,d,f[200001],mod=998244353ll;
void up(long long a){
	t[a].s=(t[a*2ll].s*f[t[a*2ll+1ll].sz]+t[a*2ll+1ll].s)%mod;
}
void down(long long a,long long c){
	t[a].s=(t[a].p*c)%mod;
	t[a].la=c;
}
void downtag(long long a){
	if(t[a].la){
		down(a*2ll,t[a].la);
		down(a*2ll+1ll,t[a].la);
		t[a].la=0ll;
	}
}
void build(long long a,long long l,long long r){
	t[a].sz=r-l+1ll;
	if(l==r){
		t[a].s=1ll;
		t[a].la=0ll;
		t[a].p=1ll;
		return;
	}
	long long mid=(l+r)/2ll;
	build(a*2ll,l,mid);
	build(a*2ll+1ll,mid+1ll,r);
	up(a);
	t[a].p=t[a].s;
}
void turn(long long a,long long l,long long r,long long ql,long long qr,long long c){
	if(l>qr||r<ql)return;
	if(ql<=l&&r<=qr){
		down(a,c);
		return;
	}
	downtag(a);
	long long mid=(l+r)/2ll;
	turn(a*2ll,l,mid,ql,qr,c);
	turn(a*2ll+1ll,mid+1ll,r,ql,qr,c);
	up(a);
}
int main(){
	scanf("%lld%d",&n,&m);
	f[0ll]=1ll;
	for(long long i=1ll;i<=n;i++)f[i]=(f[i-1ll]*10ll)%mod;
	build(1ll,1ll,n);
	for(long long i=1ll;i<=m;i++){
		scanf("%lld%d%d",&x,&y,&d);
		turn(1ll,1ll,n,x,y,d);
		printf("%lld\n",t[1ll].s);
	}
}