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
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 998244353; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

class lazySegTree(object):
	def __init__(self, N):
		self.N = N
		self.LV = (N - 1).bit_length()
		self.N0 = 2 ** self.LV
		self.data = [0] * (2 * self.N0)
		self.lazy = [0] * (2 * self.N0)
		self.size = [1] * (2 * self.N0)
		for i in range(self.N):
			self.size[self.N0 - 1 + i] = pow(10, self.N - i - 1 , mod)
		for i in range(self.N0 - 2, -1, -1):
			self.size[i] = (self.size[2 * i + 1] + self.size[2 * i + 2]) % mod

	# 遅延セグ木の初期化
	def initialize(self):
		for i in range(self.N):
			self.data[self.N0 - 1 + i] = pow(10, self.N - i - 1, mod)
		for i in range(self.N0 - 2, -1, -1):
			self.data[i] = (self.data[2 * i + 1] + self.data[2 * i + 2]) % mod

	# 遅延伝播を行うindexを生成
	def gindex(self, l, r):
		L = (l + self.N0) >> 1; R = (r + self.N0) >> 1
		lc = 0 if l & 1 else (L & -L).bit_length()
		rc = 0 if r & 1 else (R & -R).bit_length()
		for i in range(self.LV):
			if rc <= i:
				yield R
			if L < R and lc <= i:
				yield L
			L >>= 1; R >>= 1

	# 遅延伝搬処理
	def propagates(self, *ids):
		for i in reversed(ids):
			v = self.lazy[i - 1]
			if not v:
				continue
			self.lazy[2 * i - 1] = v; self.lazy[2 * i] = v
			self.data[2 * i - 1] = v * self.size[2 * i - 1]
			self.data[2 * i] = v * self.size[2 * i]
			self.lazy[i - 1] = 0

	def update(self, l, r, x):
		*ids, = self.gindex(l, r + 1)
		self.propagates(*ids)

		L = self.N0 + l; R = self.N0 + r + 1
		while L < R:
			if R & 1:
				R -= 1
				self.lazy[R - 1] = x; self.data[R - 1] = x * self.size[R - 1]
			if L & 1:
				self.lazy[L - 1] = x; self.data[L - 1] = x * self.size[L - 1]
				L += 1
			L >>= 1; R >>= 1
		for i in ids:
			self.data[i - 1] = (self.data[2 * i - 1] + self.data[2 * i]) % mod

	# 区間[l, r]内の和を求める
	def query(self, l, r):
		self.propagates(*self.gindex(l, r + 1))
		L = self.N0 + l; R = self.N0 + r + 1
		s = 0
		while L < R:
			if R & 1:
				R -= 1
				s += self.data[R - 1]
			if L & 1:
				s += self.data[L - 1]
				L += 1
			L >>= 1; R >>= 1
			s %= mod
		return s

	# デバッグ用
	def debug(self):
		ids = [i for i in range(self.N0 - 1, 0, -1)]
		self.propagates(*ids)
		print(self.data[self.N0 - 1:])

def main():
	N, Q = getlist()
	lSeg = lazySegTree(N)
	lSeg.initialize()
	# lSeg.debug()
	for i in range(Q):
		L, R, D = getlist()
		L -= 1; R -= 1
		lSeg.update(L, R, D)
		ans = lSeg.query(0, N - 1)
		print(ans)





if __name__ == '__main__':
	main()