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 rep(i, l, r) for(int i = (l); i <= (r); i++)
#define per(i, r, l) for(int i = (r); i >= (l); i--)
#define mem(a, b) memset(a, b, sizeof a)
#define mid ((l + r) >> 1)
#define lch l, mid, o << 1
#define rch mid + 1, r, o << 1 | 1

using namespace std;
const int N = 2e5 + 5, P = 998244353;
typedef long long ll;
int n, q, tag[N*4]; ll ten = 1, g[N*4], c[N*4];
void pushup(int o) { c[o] = (c[o<<1] + c[o<<1|1]) % P; }
void put(int v, int o) { c[o] = g[o] * v % P, tag[o] = v; }
void pushdown(int o) {
	if(~tag[o]) put(tag[o], o<<1), put(tag[o], o<<1|1), tag[o] = -1;
}
void bld(int l, int r, int o) {
	tag[o] = -1;
	if(l == r) return g[o] = c[o] = ten, ten = ten * 10 % P, void();
	bld(rch), bld(lch), pushup(o), g[o] = c[o];
}
void upd(int L, int R, int v, int l, int r, int o) {
	if(L <= l && r <= R) return put(v, o);
	pushdown(o);
	if(L <= mid) upd(L, R, v, lch);
	if(R > mid) upd(L, R, v, rch); 
	pushup(o);
}

int main() {
	cin >> n >> q, bld(1, n, 1);
	while(q--) {
		int l, r, v; scanf("%d%d%d", &l, &r, &v);
		upd(l, r, v, 1, n, 1), printf("%lld\n", c[1]);
	}
	return 0;
}