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;
#define SZ(a) ((int)(a).size())
typedef long long int64;
const int maxn = 200009;
const int mod = 998244353;
int64 T[maxn << 2], D[maxn], n, q, lz[maxn << 2], DD[maxn];

void upd(int rt, int l, int r, int ll, int rr, int v) {
  if (ll <= l && rr >= r) {
    lz[rt] = v;
    T[rt] = DD[r - l + 1] * D[n - r] % mod * v % mod;
    return;
  }
  int mid = (l + r) >> 1;
  if (lz[rt]) {
    lz[rt << 1] = lz[rt];
    lz[rt << 1 | 1] = lz[rt];
    T[rt << 1] = lz[rt] * DD[mid - l + 1] % mod * D[n - mid] % mod;
    T[rt << 1 | 1] = lz[rt] * DD[r - mid] % mod * D[n - r] % mod;
    lz[rt] = 0;
  }
  if (ll <= mid) upd(rt << 1, l, mid, ll, rr, v);
  if (rr > mid) upd(rt << 1 | 1, mid + 1, r, ll, rr, v);
  T[rt] = (T[rt << 1] + T[rt << 1 | 1]) % mod;
}
int main() {
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  D[0] = 1;
  for (int i = 1; i < maxn; ++i) D[i] = D[i - 1] * 10 % mod;
  DD[1] = 1;
  for (int i = 2; i < maxn; ++i) DD[i] = (DD[i - 1] * 10 + 1) % mod;
  cin >> n >> q;
  upd(1, 1, n, 1, n, 1);
  while (q--) {
    int l, r, v;
    cin >> l >> r >> v;
    upd(1, 1, n, l, r, v);
    cout << T[1] << '\n';
  }

  return 0;
}
//2020.09.26 20:15:23