This problem differs from the next one only in the presence of the constraint on the equal length of all numbers $a_1, a_2, \dots, a_n$. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too.

A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the students don't know the coordinates of the ship, so they asked Meshanya (who is a hereditary mage) to help them. He agreed to help them, but only if they solve his problem.

Let's denote a function that alternates digits of two numbers $f(a_1 a_2 \dots a_{p - 1} a_p, b_1 b_2 \dots b_{q - 1} b_q)$, where $a_1 \dots a_p$ and $b_1 \dots b_q$ are digits of two integers written in the decimal notation without leading zeros.

In other words, the function $f(x, y)$ alternately shuffles the digits of the numbers $x$ and $y$ by writing them from the lowest digits to the older ones, starting with the number $y$. The result of the function is also built from right to left (that is, from the lower digits to the older ones). If the digits of one of the arguments have ended, then the remaining digits of the other argument are written out. Familiarize with examples and formal definitions of the function below.

For example: $$f(1111, 2222) = 12121212$$ $$f(7777, 888) = 7787878$$ $$f(33, 44444) = 4443434$$ $$f(555, 6) = 5556$$ $$f(111, 2222) = 2121212$$

Formally,  if $p \ge q$ then $f(a_1 \dots a_p, b_1 \dots b_q) = a_1 a_2 \dots a_{p - q + 1} b_1 a_{p - q + 2} b_2 \dots a_{p - 1} b_{q - 1} a_p b_q$;  if $p < q$ then $f(a_1 \dots a_p, b_1 \dots b_q) = b_1 b_2 \dots b_{q - p} a_1 b_{q - p + 1} a_2 \dots a_{p - 1} b_{q - 1} a_p b_q$. 

Mishanya gives you an array consisting of $n$ integers $a_i$. All numbers in this array are of equal length (that is, they consist of the same number of digits). Your task is to help students to calculate $\sum_{i = 1}^{n}\sum_{j = 1}^{n} f(a_i, a_j)$ modulo $998\,244\,353$.


-----Input-----

The first line of the input contains a single integer $n$ ($1 \le n \le 100\,000$) — the number of elements in the array. The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$) — the elements of the array. All numbers $a_1, a_2, \dots, a_n$ are of equal length (that is, they consist of the same number of digits).


-----Output-----

Print the answer modulo $998\,244\,353$.


-----Examples-----
Input
3
12 33 45

Output
26730
Input
2
123 456

Output
1115598
Input
1
1

Output
11
Input
5
1000000000 1000000000 1000000000 1000000000 1000000000

Output
265359409

Source: codeforces | Difficulty: MEDIUM
Tags: Number theory

Combinatorics

Mathematics


Solutions:
n = int(input())
a = list(map(str, input().split()))
ans = 0
mod = 998244353
for i in range(n):
	s = ''
	for j in range(0, len(a[i])):
		s += a[i][j]
		s += a[i][j]
	x = int(s)
	ans += x % mod * n % mod
print(ans % mod)


n = int(input())
lis = list(map(str, input().split()))
su = 0
ans = 0
c = ''
for i in lis:
	c = ''
	for j in i:
		c += '0' + j
	ans += int(c) * n
	c = ''
	for j in i:
		c += j + '0'
	ans += int(c) * n
print(ans % 998244353)


n = int(input())
a = input()
b = a.split(' ')
l = len(b[0])
z = ''
times = []
pre = []
for i in range(12):
	times.append(0)
	pre.append(0)
for i in range(n):
	times[len(b[i])] = times[len(b[i])] + 1
p = 998244353
pre[1] = times[1]
for i in range(2, 12):
	pre[i] = pre[i - 1] + times[i]
su = 0
for i in range(n):
	cur = b[i]
	siz = len(b[i])
	num = ''
	for j in range(siz):
		num = num + b[i][j]
		num = num + '0'
	num = int(num)
	su = (su % p + num % p * (pre[10] - pre[siz - 1]) % p % p) % p
	num = num // 10
	su = (su % p + num % p * (pre[10] - pre[siz - 1]) % p % p) % p
	for j in range(1, siz):
		if times[j] == 0:
			continue
		dif = siz - j
		cur_num1 = cur[0:dif]
		cur_num2 = cur[0:dif]
		for k in range(dif, siz):
			cur_num1 = cur_num1 + cur[k]
			cur_num1 = cur_num1 + '0'
			cur_num2 = cur_num2 + '0'
			cur_num2 = cur_num2 + cur[k]
		cur_num1 = int(cur_num1)
		cur_num2 = int(cur_num2)
		su = (su % p + cur_num1 % p * times[j] % p % p) % p
		su = (su % p + cur_num2 % p * times[j] % p % p) % p
print(su)


import sys
from math import sqrt
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 998244353
n = int(input())
a = input().split()
ans = 0
d = dict()
for i in a:
	d[len(i)] = d.get(len(i), 0) + 1
for i in a:
	j = 1
	tot = 0
	while j < len(i):
		if j in d:
			b = str()
			b += i[:len(i) - j] + '00' * j
			ans += int(b) * d[j] * 2
			b = str()
			for k in i[len(i) - j:]:
				b += k * 2
			ans += int(b) * d[j]
			tot += d[j]
		j += 1
	b = str()
	for j in i:
		b += j * 2
	ans += int(b) * (n - tot)
	ans = ans % mod
print(ans % mod)


n = int(input())
a = list(map(int, input().split()))
s = 0
k = len(str(a[0]))
for i in range(n):
	b = a[i]
	d = 10
	for j in range(k):
		s += n * (b % d // (d // 10) * (d // 10) * (d // 10) + b % d // (d // 10) * (d // 10) * (d // 10) * 10)
		d *= 10
		s %= 998244353
print(s)


MOD = 998244353
n = int(input())
a = list(input().split())

def func(a_: str):
	score = ''
	for i in list(a_):
		score += str(i) * 2
	return int(score) * n % MOD
ans = 0
for i in range(n):
	ans = (ans + func(a[i])) % MOD
print(ans)


MOD = 998244353

def cntFt(i):
	cnt = 1
	ans = 0
	while i:
		ans += 10 ** cnt * (i % 10)
		i //= 10
		cnt += 2
	return ans

def cntSd(i):
	cnt = 0
	ans = 0
	while i:
		ans += 10 ** cnt * (i % 10)
		i //= 10
		cnt += 2
	return ans
n = int(input())
sum = 0
for i in list(map(int, input().split())):
	sum += cntFt(i) * n
	sum += cntSd(i) * n
print(sum % MOD)


n = int(input())
l = list(map(int, input().split()))
M = 998244353
ans = 0
m = len(str(l[0]))
for x in l:
	s = ''.join([c * 2 for c in str(x)])
	s = int(s) % M
	ans = (ans + s * n) % M
print(ans)


n = int(input())
question = input().split()
number = 0
carry = 0
for i in range(n):
	question[i] = list(map(int, list(question[i])))
transposed = list(zip(*question))
for i in range(1, len(question[0]) + 1):
	query = n * sum(transposed[-i]) + carry
	number += 10 ** (2 * i - 2) * (query % 10)
	carry = query // 10
	query = n * sum(transposed[-i]) + carry
	number += 10 ** (2 * i - 1) * (query % 10)
	carry = query // 10
number += 10 ** (2 * len(question[0])) * carry
print(number % 998244353)


b = 998244353
n = int(input())
arr = input().split()
s = 0
for a in arr:
	l = list(a)
	l1 = int(''.join(['%s0' % x for x in l]))
	l2 = int(''.join(['0%s' % x for x in l]))
	s = (s + l1 * n) % b
	s = (s + l2 * n) % b
print(s)


n = int(input())
a = list(map(int, input().split()))
b = []
sum1 = 0

def reverse(string):
	string = ''.join(reversed(string))
	return string
for i in range(n):
	t = a[i]
	s = ' '
	c = []
	while t > 0:
		x = t % 10
		s = s + str(x)
		s = s + str(x)
		t = t // 10
	s = reverse(s)
	b.append(s)
for i in range(len(b)):
	x = int(b[i])
	sum1 += x * n
print(sum1 % 998244353)


n = int(input())
s = input().split(' ')
out = 0

def f(a, b):
	out = ''
	for i in range(1, len(b) + 1):
		out += b[len(b) - i]
		out += a[len(a) - i]
	return out[::-1]
for i in range(n):
	out += int(f(s[i], s[i]))
out *= n
out %= 998244353
print(out)


variable1 = int(input())
LISTT = list(map(int, input().split()))
variable2 = []
XX = len(str(LISTT[0]))
outp = [10 ** iteratorr for iteratorr in range(20)]
for iteratorr in LISTT:
	iteratorr = str(iteratorr)
	p = 0
	YY = 0
	z = 2 * XX - 1
	z1 = 2 * XX - 2
	for j in iteratorr:
		j = int(j)
		p += j * outp[z]
		YY += j * outp[z1]
		z -= 2
		z1 -= 2
	variable2.append((p + YY) % 998244353 * variable1 % 998244353)
Z = 0
for iteratorr in variable2:
	Z += iteratorr % 998244353
print(Z % 998244353)


n = int(input())
l = list(input().strip().split())
sum = 0
dic = {}
for i in range(n):
	if len(l[i]) in dic:
		dic[len(l[i])] += 1
	else:
		dic[len(l[i])] = 1

def calc(a, k):
	a0 = a[-k:]
	a1 = a[:-k]
	A1 = 0
	if a1 != '':
		A1 = int(a1) * 10 ** (k * 2) * 2
	ans = ''
	for k in a0:
		ans += k * 2
	return A1 + int(ans)
for i in range(n):
	for k in dic:
		sum += calc(l[i], k) * dic[k] % 998244353
		sum = sum % 998244353
print(sum)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def countDigit(n):
	count = 0
	while n != 0:
		n //= 10
		count += 1
	return count
n = int(input())
l = list(map(int, input().split()))
h = countDigit(l[0])
d = [0] * h
t = 1
su = 0
for i in range(h - 1, -1, -1):
	for j in range(n):
		d[i] += l[j] % 10
		l[j] //= 10
	d[i] *= n
	su = (su % 998244353 + 11 * d[i] * t % 998244353) % 998244353
	t *= 100
print(su)


n = int(input())
l = [int(x) for x in input().split()]
ans = 0
p = 0
while l[0] != 0:
	for i in range(n):
		x = l[i] % 10
		ans = ((x * 10 + x) * n * 10 ** p + ans) % 998244353
		l[i] //= 10
	p += 2
print(ans % 998244353)


n = int(input())
a = list(input().split())
ans = 0
for x in a:
	num = ''
	for y in x:
		num += y + y
	num = int(num)
	ans += num
	ans %= 998244353
ans *= n
ans %= 998244353
print(ans)


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	size = len(str(a[0]))
	ans = 0
	MOD = 998244353
	ten = [1]
	for i in range(1, 21):
		ten.append(ten[-1] * 10)
	for i in range(n):
		for j in range(size):
			ans += int(str(a[i])[j]) * ten[2 * size - 2 * j - 1] * n
			ans += int(str(a[i])[j]) * ten[2 * size - 2 * j - 2] * n
			ans %= MOD
	print(ans)
main()


n = int(input())
line = input().split()
a = []
for num in line:
	a.append(int(num))
res = 0
for x in a:
	place = 1
	while x > 0:
		digit = x % 10
		res += n * digit * place
		place *= 10
		res += n * digit * place
		x //= 10
		place *= 10
		res %= 998244353
print(res % 998244353)


mod = 998244353
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
	x = a[i]
	(cur, pw) = (0, 1)
	while x:
		cur += 11 * (x % 10) * pw
		x = x // 10
		pw *= 100
	s += cur
	if s >= mod:
		s %= mod
print(s * n % mod)


def f(a):
	b = ''
	for digit in a:
		b += 2 * digit
	return int(b)
n = int(input())
a = input().split()
ans = 0
for num in a:
	ans += f(num) * n
print(ans % 998244353)


mod = 998244353

def cal(a, b, n):
	arr_a = list(map(int, str(a)))
	arr_b = list(map(int, str(b)))
	ans_a = ''
	for i in range(len(arr_a)):
		ans_a += str(arr_a[i]) + '0'
	ans_b = ''
	for i in range(len(arr_b)):
		ans_b += '0' + str(arr_b[i])
	ans_a = int(ans_a) % mod
	ans_b = int(ans_b) % mod
	return (ans_a + ans_b) % mod
n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans = (cal(arr[i], arr[i], n) + ans) % mod
ans = ans * (n % mod) % mod
print(ans)


import math
n = int(input())
arr = list(map(int, input().split()))
x = int(math.log10(arr[0])) + 1
count = 0
power = 1
for j in range(x):
	temp = 0
	for i in range(len(arr)):
		temp += arr[i] % 10
		arr[i] //= 10
	temp *= n * 11
	count += temp * power
	power *= 100
print(count % 998244353)


n = int(input())
ls = list(map(int, input().split()))
cnt = 0
mod = 998244353
for num in ls:
	j = 1
	for i in str(num)[::-1]:
		cnt += int(i) * j * n % mod
		cnt += int(i) * (j * 10) * n % mod
		j *= 100
print(cnt % mod)


n = int(input())
a = input().split()
p = len(a[0])
ans = [0 for _ in range(2 * p + 1)]
for i in range(2 * p, 0, -1):
	for num in a:
		ans[i] += int(num[(i + 1) // 2 - 1]) * n
	ans[i - 1] = ans[i] // 10
	ans[i] = ans[i] % 10
q = 0
for digit in ans:
	q = q * 10 + digit
print(q % 998244353)


_MODER = 998244353

def solve(n, a):
	r = 0
	for e in a:
		ns = ''
		for ch in str(e):
			ns += ch + ch
		r = (r + int(ns) * n % _MODER) % _MODER
	return r
n = int(input())
a = list(map(int, input().split()))
r = solve(n, a)
print(r)


import sys
input = sys.stdin.readline
n = int(input())
A = list(input().split())
mod = 998244353

def dup(a):
	ANS = ''
	for k in a:
		ANS += k * 2
	return int(ANS)
B = [dup(a) for a in A]
ANS = 0
for b in B:
	ANS = (ANS + b * n) % mod
print(ANS)


def mod(a):
	return a % 998244353
n = int(input())
l = list(input().split(' '))
sizeL = len(l[-1])
sumAll = 0
x = 0
for i in range(sizeL - 1, -1, -1):
	for j in l:
		temp = mod(mod(int(j[i])) * n)
		sumAll = mod(sumAll + mod(temp * 10 ** x))
		sumAll = mod(sumAll + mod(temp * 10 ** (x + 1)))
	x += 2
print(sumAll)


from sys import stdin
import math
from collections import defaultdict, deque
import bisect
I = stdin.readline
mod = 998244353

def fun(n):
	p = 0
	x = 0
	while n != 0:
		rem = n % 10
		n -= rem
		rem = rem * pow(10, 2 * p, mod) % mod
		x += rem
		x %= mod
		p += 1
		n /= 10
	return x
n = int(I())
arr = [int(x) for x in I().split()]
ans = 0
for i in arr:
	x = fun(i)
	y = 10 * x % mod
	x *= n
	x %= mod
	y *= n
	y %= mod
	ans += (x + y) % mod
	ans %= mod
print(int(ans))


n = int(input())
l = list(map(int, input().split()))
s = 0
for x in l:
	k = x
	i = 0
	while k:
		d = k % 10
		k //= 10
		s += d * int('1' + '0' * (2 * i))
		s %= 998244353
		i += 1
s = s * 11 * n
s %= 998244353
print(s)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	n = N()
	arr = RLL()
	res = 0
	ldic = defaultdict(int)
	for i in arr:
		ldic[len(str(i))] += 1
	for i in arr:
		p = res
		pre = suf = 0
		tag = 1
		ole = len(str(i))
		nle = 0
		while i > 0:
			lst = i % 10
			pre += lst * tag
			suf += lst * (tag * 10)
			tag *= 100
			i //= 10
			nle += 1
			le = ldic[nle]
			if le != 0:
				res = (res + pre * le % mod + suf * le % mod + 2 * i * tag * le) % mod
		grt = 0
		for j in ldic:
			if j > ole:
				grt += ldic[j]
		res = (res + pre * grt % mod + suf * grt % mod) % mod
	print(res % mod)
main()


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = 1
mod = 998244353

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	l1 = [0 for j in range(21)]
	l2 = [0] * 12
	d = {}
	d1 = {}
	for i in range(n):
		x = l[i]
		j = 0
		cnt = 0
		while x:
			x //= 10
			j += 1
			cnt += 1
		d1[i] = cnt
		d[cnt] = d.get(cnt, 0) + 1
	for i in range(n):
		for j in range(12):
			l2[j] = 0
		d[d1[i]] -= 1
		j = 0
		x1 = d1[i]
		x = l[i]
		while x:
			l2[j] = x % 10
			x //= 10
			j += 1
		for i1 in d:
			if d[i1] != 0:
				(j1, ind) = (0, 0)
				for i2 in range(i1):
					l1[j1] += d[i1] * l2[ind]
					j1 += 2
					ind += 1
				for i2 in range(ind, d1[i]):
					l1[j1] += l2[i2] * d[i1]
					j1 += 1
				(j1, ind) = (1, 0)
				for i2 in range(i1):
					l1[j1] += d[i1] * l2[ind]
					j1 += 2
					ind += 1
				j1 -= 1
				for i2 in range(ind, d1[i]):
					l1[j1] += l2[i2] * d[i1]
					j1 += 1
		(j, ind) = (0, 0)
		for i1 in range(d1[i]):
			l1[j] += l2[ind]
			l1[j + 1] += l2[ind]
			ind += 1
			j += 2
		d[d1[i]] += 1
	suma = 0
	mul = 1
	for j in range(21):
		suma = (suma % mod + mul % mod * (l1[j] % mod) % mod) % mod
		mul = mul % mod * 10 % mod % mod
	return suma % mod
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(solve())


n = int(input())
A = [int(i) for i in input().split()]
k = len(str(A[0]))
sum = 0
for i in A:
	for (index, c) in enumerate(str(i)[::-1]):
		l = int(c)
		sum += (l + 10 * l) * 10 ** (index * 2)
sum *= n
print(sum % 998244353)


import sys
import math
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
l = len(str(arr[0]))
p = 998244353
ans = 0
for i in range(l):
	cur = 0
	for j in range(n):
		cur += int(str(arr[j])[i])
	cur *= n
	ans += cur * 10 ** (2 * (l - i) - 1) % p
	ans += cur * 10 ** (2 * (l - i) - 2) % p
print(ans % p)


import math as ma

def num():
	return map(int, input().split())

def nu():
	return int(input())

def li():
	return input().split()

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

def fli():
	return [float(x) for x in input().split()]

def FindLen(num):
	c = 0
	while num > 0:
		c += 1
		num //= 10
	return c
x = [[0] * 15 for i in range(15)]
y = [[0] * 15 for i in range(15)]
MOD = 998244353
p = [10 ** i for i in range(22)]
f = [0] * 18
n = nu()
a = lli()
for i in range(n):
	l = FindLen(a[i])
	f[l] += 1
for i in range(n):
	next_add = 0
	l = FindLen(a[i])
	for j in range(1, l + 1):
		val = a[i]
		val //= p[j - 1]
		val *= p[2 * j - 1]
		val += next_add
		next_add = val % p[2 * j]
		x[l][j] += val
		x[l][j] %= MOD
		val //= 10
		y[l][j - 1] += val
		y[l][j - 1] %= MOD
ans = 0
for i in range(1, 11):
	if f[i] > 0:
		for j in range(1, i):
			if f[j] > 0:
				ans += (f[j] * x[i][j] + f[i] * y[j][j - 1]) % MOD
				ans %= MOD
		ans += f[i] * (x[i][i] + y[i][i - 1]) % MOD % MOD
		ans %= MOD
		for j in range(i + 1, 11):
			if f[j] > 0:
				ans += (f[i] * y[j][i] % MOD + f[j] * x[i][i] % MOD) % MOD
				ans %= MOD
print(ans)


from collections import defaultdict as dd, deque as dq
import math, string
import sys

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 998244353
tens = [1]
curr = 1
for i in range(1, 10 ** 5 + 5):
	curr *= 10
	curr %= MOD
	tens.append(curr)

def solve():
	N = getInt()
	A = getInts()
	lens = [0] * 11
	for a in A:
		lens[len(str(a))] += 1
	ans = 0
	for a in A:
		X = [int(s) for s in str(a)]
		for (i, x) in enumerate(X):
			for k in range(1, 11):
				if not lens[k]:
					continue
				L = lens[k]
				if len(X) - i > k:
					ans += int(x) * tens[k + len(X) - i - 1] * L * 2
					ans %= MOD
				else:
					ans += int(x) * tens[2 * (len(X) - i - 1)] * L * 11
					ans %= MOD
	return ans
print(solve())


n = int(input())
l = [int(i) for i in input().split()]

def liste(n):
	l = []
	while n != 0:
		l.append(n % 10)
		n //= 10
	return l

def aug1(l):
	l.reverse()
	res = []
	for k in l:
		res.append(k)
		res.append(0)
	s = 0
	for k in res:
		s += k
		s *= 10
	s //= 10
	return s

def aug2(l):
	l.reverse()
	res = []
	for k in l:
		res.append(k)
		res.append(0)
	res.pop()
	s = 0
	for k in res:
		s += k
		s *= 10
	s //= 10
	return s
s = 0
modulo = 998244353
for k in l:
	s += n * (aug1(liste(k)) + aug2(liste(k)))
	s = s % modulo
print(s)


import sys, math, queue, bisect
MOD = 998244353
sys.setrecursionlimit(1000000)

def first(n, d):
	p = 0
	a = 0
	while n > 0:
		a += n % 10 * pow(10, p, MOD)
		if d > 0:
			p += 2
			d -= 1
		else:
			p += 1
		n = n // 10
		a = a % MOD
	return a

def second(n, d):
	p = 1
	a = 0
	d -= 1
	while n > 0:
		a += n % 10 * pow(10, p, MOD)
		if d > 0:
			p += 2
			d -= 1
		else:
			p += 1
		n = n // 10
		a = a % MOD
	return a
n = int(input())
a = list(map(int, input().split()))
d = {i: 0 for i in range(1, 11)}
for ai in a:
	d[len(str(ai))] += 1
ans = 0
for ai in a:
	for di in d:
		ans += d[di] * first(ai, di) % MOD
		ans += d[di] * second(ai, di) % MOD
		ans = ans % MOD
print(ans)


a = int(input())
c = list(map(int, input().split()))
summ = 0
for i in range(a):
	k = 0
	k1 = 0
	s = str(c[i])
	for x in s:
		k = k * 100 + int(x)
	k1 = k * 10
	summ += (k + k1) * a
	summ %= 998244353
print(summ)


n = int(input())
a = []
b = map(int, input().split())
a = list(b)

def f(k):
	smal = 0
	big = 0
	step = 1
	while k > 0:
		ost = k % 10
		smal += ost * step
		big += ost * step * 10
		k = k // 10
		step *= 100
	return big + smal
summ = 0
for i in range(n):
	summ += n * f(a[i])
summ = summ % 998244353
print(summ)


n = int(input())
l = list(map(int, input().split()))
ans = 0
for j in range(10):
	for i in range(n):
		x = l[i] % 10
		l[i] //= 10
		lav = pow(10, 2 * j)
		ans += (lav * x + lav * 10 * x) * n
		ans %= 998244353
print(ans)


mod = 998244353
n = int(input())
arr = list(input().split())
l = len(arr[0])
sumar = [0 for i in range(l)]
for i in range(n):
	for j in range(l - 1, -1, -1):
		sumar[j] += int(arr[i][j])
		sumar[j] %= mod
ans = 0
p = 0
for i in range(l - 1, -1, -1):
	ans += sumar[i] * (pow(10, 2 * p, mod) * n % mod)
	ans %= mod
	ans += sumar[i] * (pow(10, 2 * p + 1, mod) * n % mod)
	ans %= mod
	p += 1
print(ans)


n = int(input())
a = list(input().split())
f = [0] * 10
for x in a:
	for i in range(len(x)):
		f[i] += ord(x[i]) - ord('0')
ans = 0
mod = 998244353
for x in a:
	p = 10 ** (len(x) * 2 - 1)
	for i in range(len(x)):
		ans += n * (ord(x[i]) - ord('0')) * p % mod
		p //= 10
		ans += f[i] * p % mod
		p //= 10
		ans %= mod
print(ans % mod)


n = int(input())
ans = 0
arr = input().split()
for i in range(n):
	a = int(arr[i])
	k = 1
	while a > 0:
		ans += n * (a % 10) * k
		ans %= 998244353
		ans += n * (a % 10) * 10 * k
		ans %= 998244353
		ans %= 998244353
		a = a // 10
		k *= 100
print(ans % 998244353)


a = int(input())
li = list(map(int, input().split()))
b = []
zz = len(str(li[0]))
op = [10 ** i for i in range(20)]
r = 998244353
for i in li:
	i = str(i)
	p = 0
	q = 0
	z = 2 * zz - 1
	z1 = 2 * zz - 2
	for j in i:
		j = int(j)
		p += j * op[z]
		q += j * op[z1]
		z -= 2
		z1 -= 2
	b.append((p + q) % r * a % r)
ans = 0
for i in b:
	ans += i % r
print(ans % r)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
threading.stack_size(10 ** 8)
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
modulo = 998244353
from collections import Counter

def conv(x):
	res = 0
	for v in x:
		res = (res * 100 + int(v)) % modulo
	return res
n = int(input())
x = list(input().split())
c = Counter((len(v) for v in x))
res = 0
for v in x:
	u = len(v)
	for (w, k) in c.items():
		if w >= u:
			res += k * 11 * conv(v)
		else:
			d = u - w
			res += k * 11 * conv(v[d:])
			res += k * 2 * int(v[:d]) * 10 ** (2 * w)
	res %= modulo
print(res)


n = int(input())
lt = [str(x)[::-1] for x in input().split()]
mod = 998244353
l = len(lt[0])
An = 0
for i in range(l):
	ans = 0
	for j in lt:
		ans += int(j[i]) * n
	An = (An % mod + 10 ** (2 * i) % mod * ans % mod + 10 ** (2 * i + 1) % mod * ans % mod) % mod
print(An)


n = int(input())
a = list(map(str, input().split()))
ans = 0
for t in a:
	s = ''
	for j in t:
		s += 2 * j
	ans += int(s)
	ans %= 998244353
print(n * ans % 998244353)


n = int(input())
A = [int(i) for i in input().split()]
k = len(str(A[0]))
mod = 998244353
ans = 0
for i in range(n):
	for j in range(k):
		a = int(str(A[i])[j])
		ans += 10 ** (2 * (k - j) - 1) * a * n
		ans += 10 ** (2 * (k - j) - 2) * a * n
		ans %= mod
a = str(A[0])
nn = len(a)
ans1 = 0
for i in range(nn):
	ans1 += int(a[i]) * 10 ** (2 * (nn - i) - 1)
	ans1 += int(a[i]) * 10 ** (2 * (nn - i) - 2)
print(ans1 % mod if n == 1 else ans)


import io, sys
input = lambda f=io.StringIO(sys.stdin.buffer.read().decode()).readline: f().rstrip()
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
MOD = 998244353
pow10 = [10 ** i % MOD for i in range(61)]
n = ii()
a = li()
ans = 0
for x in a:
	for i in range(30):
		d = x % 10
		ans += (pow10[2 * i] + pow10[2 * i + 1]) * d % MOD
		x //= 10
	ans %= MOD
print(ans * n % MOD)


n = int(input())
l = list(input().strip().split())
sum = 0
k = len(l[0])
for i in range(n):
	a = 2 * k
	for j in range(k):
		sum += int(l[i][j]) * 10 ** (a - 1) * n
		a -= 1
		sum = sum % 998244353
		sum += int(l[i][j]) * 10 ** (a - 1) * n
		sum = sum % 998244353
		a -= 1
print(sum)


mod = 998244353

def main():
	n = int(input())
	A = list(map(int, input().split()))
	N = 10 ** 6
	table = [0] * (N + 1)
	table[0] = 1
	for i in range(1, N + 1):
		table[i] = table[i - 1] * 10
		table[i] %= mod
	C = [0] * 11
	for a in A:
		C[len(str(a))] += 1
	ans = 0
	for (i, a) in enumerate(A):
		a = str(a)
		a = list(a)
		a.reverse()
		for (j, c) in enumerate(a):
			c = int(c)
			for k in range(11):
				if k <= j:
					ans += c * table[2 * j + 1 - (j - k + 1)] * C[k]
				else:
					ans += c * table[2 * j + 1] * C[k]
			for k in range(11):
				if k <= j - 1:
					ans += c * table[2 * j - (j - k)] * C[k]
				else:
					ans += c * table[2 * j] * C[k]
			ans %= mod
	print(ans)
main()


n = int(input())
a = list(map(str, input().split()))
l = len(a[0])
ans = 0
for i in a:
	c = ''
	for j in i:
		c += '0' + j
	ans += int(c) * n
	c = ''
	for j in i:
		c += j + '0'
	ans += int(c) * n
print(ans % 998244353)


import math
n = int(input())
arr = [i for i in input().split()]
CT = [0 for i in range(40)]
for i in arr:
	CT[len(i)] += 1
P = [0 for i in range(40)]
M = 998244353
ans = 0
howmanyhavelengthlesser = [0 for i in range(40)]
howmanyhavelengthgreater = [0 for i in range(40)]
for i in range(40):
	for j in range(i):
		howmanyhavelengthlesser[i] += CT[j]
	for j in range(i + 1, 40):
		howmanyhavelengthgreater[i] += CT[j]
for i in arr:
	cur = 0
	for j in range(len(i) - 1, -1, -1):
		for k in range(cur, 2 * cur + 1):
			if k != 2 * cur:
				P[k] += int(i[j]) * CT[cur - (2 * cur - k)]
			else:
				P[k] += int(i[j]) * (howmanyhavelengthgreater[cur] + CT[cur])
		cur += 1
for i in arr:
	cur = 0
	for j in range(len(i) - 1, -1, -1):
		for k in range(cur + 1, 2 * cur + 2):
			if k == 2 * cur + 1:
				P[k] += int(i[j]) * (howmanyhavelengthgreater[cur + 1] + CT[cur + 1])
			else:
				P[k] += int(i[j]) * CT[cur + 1 - (2 * cur + 1 - k)]
		cur += 1
for i in range(30):
	ans = (ans + P[i] * pow(10, i, M)) % M
print(ans)


mod = 998244353
n = int(input())
l = list(map(str, input().split()))
d = len(l[0])
total = d + d
ans = 0
for i in range(1, d + 1):
	x = i * 2
	y = x - 1
	temp1 = pow(10, total - x + 1)
	temp2 = pow(10, total - y + 1)
	for j in range(n):
		ans += temp1 * int(l[j][i - 1]) * n
		ans += temp2 * int(l[j][i - 1]) * n
ans = ans // 10
print(ans % mod)


n = int(input())
a = [int(x) for x in input().split()]
ans = 0
mod = 998244353

def f1(x):
	ret = 0
	i = 1
	while x != 0:
		ret += x % 10 * 10 ** (i * 2 - 1)
		i += 1
		x //= 10
	return ret

def f2(x):
	ret = 0
	i = 1
	while x != 0:
		ret += x % 10 * 10 ** (i * 2 - 2)
		i += 1
		x //= 10
	return ret
for i in a:
	t = f1(i) * n % mod
	ans += t
	ans %= mod
	t = f2(i) * n % mod
	ans += t
	ans %= mod
print(ans % mod)


n = int(input())
l = list(input().split())
MOD = 998244353
for i in range(0, n):
	l[i] = list(map(int, list(l[i])))
ans = 0
for i in range(0, n):
	num = 1
	for j in range(0, len(l[0])):
		ans += l[i][len(l[0]) - 1 - j] * n * num
		ans %= MOD
		num *= 10
		ans += l[i][len(l[0]) - 1 - j] * n * num
		ans %= MOD
		num *= 10
print(ans)


import math
import sys
from collections import Counter
MOD = 1000000007

def f(a, b):
	ret = 0
	pow10 = 1
	while a and b:
		ret += b % 10 * pow10
		pow10 *= 10
		b //= 10
		ret += a % 10 * pow10
		pow10 *= 10
		a //= 10
	ret += a * pow10
	ret += b * pow10
	return ret

def ndigits(a):
	ret = 0
	while a:
		ret += 1
		a //= 10
	return ret

def contrib_for_digs(x, part_digs, x_is_a):
	partner = 10 ** (part_digs - 1)
	(a1, b1) = (partner, x)
	(a2, b2) = (2 * partner, x)
	if x_is_a:
		(a1, b1) = (b1, a1)
		(a2, b2) = (b2, a2)
	return 2 * f(a1, b1) - f(a2, b2)

def contrib(a, cnt):
	ret = 0
	for (part_digs, part_cnt) in cnt.items():
		ret += part_cnt * contrib_for_digs(a, part_digs, True)
		ret += part_cnt * contrib_for_digs(a, part_digs, False)
	return ret

def solve_case():
	n = int(input())
	a = [int(p) for p in input().split()]
	a.sort()
	digs = [ndigits(ai) for ai in a]
	cnt = Counter(digs)
	ret = 0
	for ai in a:
		ret += contrib(ai, cnt)
	print(ret % 998244353)
if __name__ == '__main__' and (not hasattr(sys, 'ps1')):
	solve_case()


f = []
u = 1
for i in range(23):
	f.append(u % 998244353)
	u *= 10

def F(sai, saj):
	p = len(sai)
	q = len(saj)
	z = ''
	if p >= q:
		for t in range(p - q):
			z += sai[t]
		for t in range(q):
			z += sai[t + p - q]
			z += saj[t]
	else:
		for t in range(q - p):
			z += saj[t]
		for t in range(p):
			z += sai[t]
			z += saj[t + q - p]
	c = 1
	r = []
	for i in range(len(z)):
		if z[i] != 'a':
			r.append(len(z) - 1 - i)
	return r

def cont(r, k):
	c = 0
	for i in range(len(k) - 1, -1, -1):
		c += f[r[i]] * int(k[i])
		c %= 998244353
	return c
n = int(input())
a = [int(x) for x in input().split()]
cnt = [0] * 11
for i in a:
	cnt[len(str(i))] += 1
d = {}
for i in range(11):
	if cnt[i]:
		d[i] = 1
k = []
g = []
memo = {}
for i in range(11):
	k.append('a' * i)
	g.append('b' * i)
for i in k:
	for j in g:
		memo[len(i), len(j), 0] = F(i, j)
		memo[len(j), len(i), 1] = F(j, i)
ans = 0
for i in a:
	e = str(i)
	for j in d:
		ans += cnt[j] * (cont(memo[len(k[j]), len(e), 0], e) + cont(memo[len(e), len(k[j]), 1], e)) % 998244353
print(ans % 998244353)


n = int(input())
c = 998244353
ans = 0
v = input().split()
for now in v:
	for j in range(len(now)):
		ans += int(now[j]) * n * 10 ** (2 * (len(now) - j) - 1)
		ans += int(now[j]) * n * 10 ** (2 * (len(now) - j) - 2)
		ans %= c
print(ans)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
inf = float('inf')
from functools import cmp_to_key
from collections import defaultdict as dd
from collections import Counter, deque
from heapq import *
import math
from math import floor, ceil, sqrt

def geti():
	return map(int, input().strip().split())

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

def getis():
	return map(str, input().strip().split())

def getls():
	return list(map(str, input().strip().split()))

def gets():
	return input().strip()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	n = geta()
	a = getl()
	ans = 0
	mod = 998244353
	for i in a:
		new = ''
		for j in str(i):
			new += j
			new += '0'
		ans += int(new) * n
		ans %= mod
		ans += int(new[:-1]) * n
		ans %= mod
	print(ans)
solve()


print(11 * int(input()) * sum((int('0'.join(x)) for x in input().split())) % 998244353)


n = int(input())
array = input().split(' ')
ans = 0
for i in array:
	p = 1
	for j in i[::-1]:
		num = int(j)
		ans += num * 11 * n * p
		p *= 100
		ans = ans % 998244353
print(ans)


from sys import stdin, stdout

def getmin(x):
	res = ''
	for c in x:
		res += c + '0'
	return int(res)

def getmax(x):
	res = ''
	for c in x:
		res += '0' + c
	return int(res)

def main():
	I = stdin.readline
	O = stdout.write
	MOD = 998244353
	n = int(I().strip())
	a = I().strip().split()
	res = 0
	for e in a:
		res += getmin(e)
		res += getmax(e)
	O(str(res % MOD * n % MOD))
main()


def submarine(arr):
	n = len(str(arr[0]))
	even = 2 * n
	odd = 2 * n - 1
	ans = []
	for i in arr:
		e = even
		o = odd
		(const1, const2) = (0, 0)
		for j in str(i):
			const1 += int(j) * 10 ** (e - 1)
			e -= 2
			const2 += int(j) * 10 ** (o - 1)
			o -= 2
		ans.append(const2)
		ans.append(const1)
	return sum(ans) * len(arr) % 998244353
a = input()
lst = list(map(int, input().strip().split()))
print(submarine(lst))


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
ls = input().split()
k = len(ls[0])
ans = 0
for j in range(k - 1, -1, -1):
	prod = 11 * n * pow(100, k - 1 - j, 998244353)
	prod %= 998244353
	Sum = 0
	for i in range(len(ls)):
		Sum += int(ls[i][j])
	prod *= Sum
	prod %= 998244353
	ans += prod
	ans %= 998244353
print(ans)


n = int(input())
arr = list(map(int, input().split()))
ans = 0
l = 0
x = arr[0]
while x != 0:
	l += 1
	x //= 10
for i in range(1, l + 1):
	s = 0
	for j in range(0, n):
		s = s + arr[j] % 10
		arr[j] //= 10
	s = s * n
	ans = ans + (s + s * 10) * 10 ** (2 * (i - 1))
ans = ans % 998244353
print(ans)


n = int(input())
A = [list(x) for x in input().split()]
res = 0
for i in range(len(A)):
	L = A[i]
	buf = []
	for j in range(len(L)):
		buf.append(L[j])
		buf.append(L[j])
	res += int(''.join(buf)) * n % 998244353
print(res % 998244353)


mod = 998244353

def main():
	n = int(input())
	A = list(map(int, input().split()))
	N = 10 ** 6
	table = [0] * (N + 1)
	table[0] = 1
	for i in range(1, N + 1):
		table[i] = table[i - 1] * 10
		table[i] %= mod
	ans = 0
	for (i, a) in enumerate(A):
		a = str(a)
		a = list(a)
		a.reverse()
		for (j, c) in enumerate(a):
			c = int(c)
			ans += c * table[2 * j + 1] * n + c * table[2 * j] * n
			ans %= mod
	print(ans)
main()


def transform(A, N):
	A_ = str(A)
	sum = 0
	for i in range(len(A_)):
		C = int(A_[-i - 1])
		sum += C * (11 * N) * 100 ** i
	return sum % 998244353
N = int(input())
A = input().split()
A = list(map(int, A))
result = 0
for i in range(N):
	result += transform(A[i], N)
	result = result % 998244353
print(result)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())

def doTheThing(s):
	t = ''
	for i in s:
		t += i
		t += i
	return int(t)
n = int(input())
a = list(input().split())
a = [doTheThing(i) for i in a]
ans = 0
for i in a:
	ans += i * n % 998244353
	ans %= 998244353
print(ans)


def mix(a, b):
	sum = 0
	i = 0
	while b:
		sum += b % 10 * 10 ** i
		b = int(b / 10)
		i += 2
	i = 1
	while a:
		sum += a % 10 * 10 ** i
		a = int(a / 10)
		i += 2
	return sum
n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	i = 0
	b = x
	(sum1, sum2) = (0, 0)
	while x:
		sum1 += x % 10 * 10 ** i
		x = int(x / 10)
		i += 2
	i = 1
	while b:
		sum2 += b % 10 * 10 ** i
		b = int(b / 10)
		i += 2
	ans += n * (sum1 + sum2)
print(ans % 998244353)


n = int(input())
t = list(map(int, input().split()))
sm = 0
INF = 998244353
for i in t:
	k = i
	z = 0
	while k > 0:
		l = k % 10
		sm = sm + (l * 10 ** z + l * 10 ** (z + 1)) * n
		k //= 10
		z += 2
	sm %= INF
print(sm)


x = int(input())
v = list(map(int, input().rstrip().split()))
su = 0
b = str(max(v))
l = len(b)
for i in range(x):
	count = 0
	for j in range(l):
		su = v[i] % 10 * x * (10 ** count + 10 ** (count + 1)) + su
		count = count + 2
		v[i] = v[i] // 10
print(su % 998244353)


n = int(input())
arr = list(map(str, input().split()))
cnt = [0] * 12
for val in arr:
	cnt[len(val)] += 1
acumcnt = [0] * 12
acumcnt[10] = cnt[10]
for i in range(9, -1, -1):
	acumcnt[i] = acumcnt[i + 1] + cnt[i]
mod = 998244353
ans = 0
modarr = [0] * 20
for i in range(20):
	modarr[i] = 10 ** i % mod % mod
for s in arr:
	for i in range(1, len(s) + 1):
		tmp = int(s[-i])
		if i == 1:
			ans += (acumcnt[2] + cnt[1]) * tmp * modarr[1] % mod
			ans += (acumcnt[2] + cnt[1]) * tmp * modarr[0] % mod
		elif i == 2:
			ans += (acumcnt[3] + cnt[2]) * tmp * modarr[3] % mod
			ans += (acumcnt[3] + cnt[2] + 2 * cnt[1]) * tmp * modarr[2] % mod
		else:
			for j in range(i, i * 2):
				if j == i * 2 - 1:
					ans += (acumcnt[i + 1] + cnt[i]) * tmp * modarr[j] % mod
				elif j == i * 2 - 2:
					ans += (acumcnt[i + 1] + cnt[i] + 2 * cnt[i - 1]) * tmp * modarr[j] % mod
				else:
					ans += 2 * cnt[j - i + 1] * tmp * modarr[j] % mod
print(ans % mod)


n = int(input())
su = 0
a = list(map(int, input().split()))
for t in range(n):
	s = str(a[t])
	count = 0
	for i in range(len(s)):
		q = ord(s[i]) - ord('0')
		count = count * 10 + q
		count = count * 10 + q
	su += count
	su %= 998244353
su *= n
su %= 998244353
print(su)


num = int(input())
mod = 998244353
data = []
inpt = input().split()
for i in inpt:
	l = [int(a) for a in i]
	l.reverse()
	data.append(l)
dig = len(data[0])
ans = 0
for j in range(dig):
	sm = 0
	for i in range(num):
		sm += data[i][j]
	ans += sm * pow(100, j, mod)
print(11 * num * ans % mod)


MAXN = 998244353
N = int(input())
a = list(map(int, list(input().rstrip().split())))
num = len(str(a[0]))
res = 0
for i in range(N):
	aa = str(a[i])
	numc = 2 * num - 1
	for j in range(len(aa)):
		res = (res + (10 ** numc + 10 ** (numc - 1)) * int(aa[j]) * N) % MAXN
		numc -= 2
print(res)


def main():
	mod = 998244353
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	for i in arr:
		x = str(i)
		l = 2 * len(x) - 1
		for j in x:
			val = pow(10, l, mod)
			val *= n * int(j)
			val = val % mod
			ans += val
			l -= 1
			val = pow(10, l, mod)
			val *= n * int(j)
			val = val % mod
			ans += val
			l -= 1
	print(ans % mod)
main()


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
MOD = 998244353
nb = RI()
na = [x for x in input().split()]
ans = 0
for x in na:
	current = ''
	for y in x:
		current += y * 2
	current = int(current)
	ans += current
	ans %= MOD
ans *= nb
ans %= MOD
print(ans)


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def f(a, b):
	a = str(a)
	b = str(b)
	fun = ''
	for i in range(2 * len(a)):
		if i % 2 == 0:
			fun = fun + a[i // 2]
		else:
			fun = fun + b[i // 2]
	return int(fun)

def solve():
	quesmod = 998244353
	n = int(input())
	a = list(read())
	ans = 0
	for x in a:
		ans += n * f(x, x) % quesmod
	print((ans + quesmod) % quesmod)
for _ in range(1):
	solve()


MOD = 998244353
n = int(input())
a = [item for item in input().split()]
ans = 0
for item in a:
	for (i, ch) in enumerate(item[::-1]):
		ans += int(ch) * 100 ** i * 11 * n
		ans %= MOD
print(ans)


n = int(input())
a = input()
b = a.split(' ')
l = len(b[0])
z = ''
for i in range(l):
	z = z + '0'
p = 998244353
su = 0
for i in range(n):
	num = ''
	for j in range(l):
		num = num + b[i][j]
		num = num + z[j]
	num = int(num)
	su = su + num % p * n % p % p
	num = num // 10
	su = su + num % p * n % p % p
	su = su % p
print(int(su % p))


n = int(input())
mod = 998244353
ans = 0
arr = list(map(int, input().split(' ')))
counti = [0] * 11
maxi = -1
for i in range(n):
	val = len(str(arr[i]))
	counti[val] += 1
	maxi = max(maxi, val)
for i in range(n):
	x = arr[i]
	curr = str(x)
	currl = len(curr)
	for f in range(1, maxi + 1):
		currc = counti[f]
		req1 = curr[0]
		if currc == 0:
			continue
		if f >= currl:
			tmp = 0
			for j in range(1, len(curr)):
				req1 += '0'
				req1 += curr[j]
			req2 = req1 + '0'
		else:
			posl = currl - f
			req1 = ''
			for j in range(0, posl):
				req1 += curr[j]
			req2 = req1
			req1 += curr[posl]
			for j in range(posl + 1, len(curr)):
				req1 += '0'
				req1 += curr[j]
			req1 += '0'
			for j in range(posl, len(curr)):
				req2 += '0'
				req2 += curr[j]
		v1 = int(req2)
		v2 = int(req1)
		v1 = v1 % mod * (currc % mod) % mod
		v2 = v2 % mod * (currc % mod) % mod
		ans = (ans % mod + v1 % mod) % mod
		ans = (ans % mod + v2 % mod) % mod
print(ans)


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right, bisect
MOD = 998244353
pow10 = []
curr = 1
for _ in range(20):
	pow10.append(curr)
	curr *= 10
	curr %= MOD
n = int(input())
a = list(map(int, stdin.readline().split()))
ans = 0
for i in a:
	temp = i
	c1 = 0
	c2 = 0
	dig = 0
	while temp > 0:
		x = temp % 10
		c1 += x * pow10[dig] % MOD
		dig += 2
		temp = temp // 10
	temp = i
	dig = 1
	while temp > 0:
		x = temp % 10
		c2 += x * pow10[dig] % MOD
		dig += 2
		temp = temp // 10
	c1 %= MOD
	c2 %= MOD
	ans += c1 * n % MOD
	ans += c2 * n % MOD
	ans %= MOD
print(ans)


MODULO = 998244353
n = int(input()) % MODULO
B = input().split(' ')
d = len(B[0])
digitSum = [0] * d
mult = 0
for digit in range(d):
	for b in B:
		digitSum[digit] += int(b[digit])
	digitSum[digit] %= MODULO
	contribution = int('1' * 2 + '0' * 2 * (d - digit - 1)) % MODULO * digitSum[digit]
	contribution %= MODULO
	mult += contribution
	mult %= MODULO
print(n * mult % MODULO)


import sys, math
readline = sys.stdin.readline
n = int(readline())
a = list(map(int, readline().split()))
tmp = [[0 for _ in range(20)] for _ in range(10)]
for i in range(n):
	s = [0 for j in range(10)]
	ss = str(a[i])
	for j in range(10):
		if j < len(ss):
			s[9 - j] = ord(ss[len(ss) - j - 1])
		else:
			s[9 - j] = 58 + j - len(ss)
	for j in range(10):
		tmp[j][s[9 - j] - 48] += 1
asd = 0
asd2 = 0
for i in range(10):
	tp = 0
	tp1 = 0
	for j in range(10):
		for k in range(10, 20):
			if tmp[i][k] != 0 and tmp[i][j] != 0:
				asd2 = (asd2 + j * tmp[i][j] * 2 * tmp[i][k] * pow(10, i * 2 - (k - 10))) % 998244353
		for k in range(10):
			tp += (10 * j + k) * tmp[i][k] * tmp[i][j]
	asd = (asd + tp * pow(100, i)) % 998244353
print((asd + asd2) % 998244353)


import math as ma

def num():
	return map(int, input().split())

def nu():
	return int(input())

def li():
	return input().split()

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

def fli():
	return [float(x) for x in input().split()]

def FindLen(num):
	c = 0
	while num > 0:
		c += 1
		num //= 10
	return c
(row, col) = (42, 42)
x = [[0] * col] * row
y = [[0] * col] * row
MOD = 998244353
p = [10 ** i for i in range(25)]
f = [0] * 18
n = nu()
a = lli()
for i in range(n):
	l = FindLen(a[i])
	f[l] += 1
for i in range(n):
	l = FindLen(a[i])
	if l == 1:
		y[1][0] = (y[1][0] + a[i]) % MOD
	next_add = 0
	pre = a[i] % 10
	for j in range(1, l + 1):
		val = a[i] // p[j - 1]
		val = val * p[2 * j - 1]
		val += next_add
		next_add = val % p[2 * j]
		val %= MOD
		x[l][j] += val
		x[l][j] %= MOD
		if j == l:
			break
		val = a[i] // p[j]
		val = val * p[2 * j]
		val = val + pre
		pre = val % p[2 * j + 1]
		val %= MOD
		y[l][j] += val
		y[l][j] %= MOD
ans = 0
for i in range(1, 11):
	if f[i] > 0:
		for j in range(1, i):
			if f[j] > 0:
				ans += (f[j] * x[i][j] + f[i] * y[j][j - 1]) % MOD
				ans %= MOD
		ans += f[i] * (x[i][i] + y[i][i - 1]) % MOD % MOD
		ans %= MOD
		for j in range(i + 1, 11):
			if f[j] > 0:
				ans += (f[i] * y[j][i] % MOD + f[j] * x[i][i] % MOD) % MOD
				ans %= MOD
print(ans)


mod = 998244353
n = int(input())
a = [int(i) for i in input().split()]
s = 0
b = ''
for i in range(n):
	s1 = str(a[i])
	b = ''
	for i in range(len(s1)):
		b = b + s1[i] + s1[i]
	s += int(b) % mod
print(s * n % mod)


n = int(input())
arr = [int(x) for x in input().split()]
ans = 0
mod = 998244353
for x in range(n):
	gv = str(arr[x])
	num = 0
	for i in gv:
		num = num * 10 + int(i)
		num = num * 10 + int(i)
	ans += num * n
print(ans % mod)


n = int(input())
sum = 0
mod = 998244353
a = [int(s) for s in input().split()]
for i in range(n):
	d = 10
	now = a[i]
	while now > 0:
		h = now % 10
		now //= 10
		sum += h * d // 10 % mod * n % mod
		sum += h * d % mod * n % mod
		sum %= mod
		d *= 100
print(sum % mod)


n = int(input())
arr = list(map(int, input().split()))
lengths = [0 for i in range(11)]
for i in arr:
	lengths[len(str(i)) - 1] += 1
ans = 0
for i in arr:
	for j in range(len(lengths)):
		ans += i * 10 * lengths[j]
		d = 10 * 100 ** j
		i = i % d + (i - i % d) * 10
		ans += i * lengths[j]
print(ans % 998244353)


MOD = 998244353
n = int(input())
v = [i[::-1] for i in input().split()]
for i in range(n):
	s = ''
	for j in range(len(v[i])):
		s += v[i][j] + v[i][j]
	v[i] = s
res = 0
for i in range(n):
	for j in range(len(v[i])):
		res += 10 ** j * int(v[i][j]) % MOD
		res %= MOD
print(res * n % MOD)


n = int(input())
a = list(map(int, input().split()))
x = 0
for _ in range(len(a)):
	s = ''
	for i in range(len(str(a[_]))):
		s += str(a[_])[i]
		s += str(a[_])[i]
	a[_] = int(s)
print(n * sum(a) % 998244353)


mo = 998244353

def get(a, i):
	return a // 10 ** i % 10
n = int(input())
a = [int(s) for s in input().split()]
ans = 0
l = len(str(a[0]))
sums = [0] * l
for i in range(n):
	for j in range(l):
		sums[j] += get(a[i], j)
for i in range(l):
	ans += sums[i] * n * 11 * 10 ** (2 * i)
	ans %= mo
print(ans)


from sys import stdin, stdout
import sys
import math
M = 998244353

def meth(a, cc):
	val = 0
	for x in a:
		y = str(x)
		val += int(y[cc])
	return val
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
mxlen = 2 * len(str(a[0]))
mxlen -= 2
res = 0
cc = 0
while mxlen >= 0:
	res += n * pow(10, mxlen) * 11 * meth(a, cc)
	res %= M
	cc += 1
	mxlen -= 2
stdout.write(str(res) + '\n')


def ch(a):
	cnt = 0
	while a > 0:
		a //= 10
		cnt += 1
	return cnt
a = int(input())
b = list(map(int, input().split()))
k = [0] * 20
for i in range(a):
	k[ch(b[i])] += 1
summ = 0
summ1 = 0
st = [1]
for i in range(25):
	st.append(st[-1] * 10)
for i in range(a):
	ot = [b[i] * 10, b[i] // 10 * 100 + b[i] % 10]
	for j in range(2, 25):
		if j % 2 == 0:
			ot.append(ot[-1] * 10)
			continue
		n = ot[j - 2]
		ot.append(n // st[j] * st[j + 1] + n % st[j])
	l = ch(b[i])
	for j in range(0, 12):
		if l == j:
			summ1 += k[j] * (ot[j * 2 - 2] + ot[j * 2 - 1])
		else:
			summ += k[j] * (ot[j * 2 - 2] + ot[j * 2 - 1])
print((summ + summ1) % 998244353)


n = int(input())
line = input()
mod = 998244353
ret = 0
for snum in line.split(' '):
	num = int(snum)
	cnt = 1
	while num:
		i = num % 10
		ret += n * (cnt * i + cnt * 10 * i)
		ret %= mod
		cnt *= 100
		num //= 10
print(ret)


n = int(input())
a = input().split()
ans = 0
for i in range(0, n):
	l = len(a[i]) * 2
	l = l - 1
	for j in range(0, len(a[i])):
		ans = ans + int(a[i][j]) * 10 ** l * n
		l -= 1
		ans = ans + int(a[i][j]) * 10 ** l * n
		l -= 1
print(ans % 998244353)


import math
n = int(input())
inp = list(map(int, input().split()))
length = len(str(inp[0]))
length *= 2
ans = 0
for num in inp:
	a = str(num)
	i = length - 1
	j = 0
	while i >= 0:
		ans += int(a[j]) * pow(10, i)
		i -= 2
		j += 1
	i = length - 2
	j = 0
	while i >= 0:
		ans += int(a[j]) * pow(10, i)
		j += 1
		i -= 2
print(ans * n % 998244353)


def transform1(num1):
	x = str(num1)
	y = ''
	for ch in x:
		y += ch
		y += '0'
	return int(y)

def transform2(num2):
	x = str(num2)
	y = ''
	for i in range(len(x) - 1):
		y += x[i]
		y += '0'
	y += x[len(x) - 1]
	return int(y)
import sys
mod = 998244353
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
ans = 0
sum1 = 0
sum2 = 0
for i in range(n):
	sum1 += transform1(a[i])
	sum2 += transform2(a[i])
ans = (sum1 + sum2) * n % mod
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
d = [0 for i in range(10)]
for i in a:
	k = 0
	while i != 0:
		d[k] += i % 10
		i = i // 10
		k += 1
res = 0
k = 0
for i in d:
	res += i * n * 11 * 10 ** k % 998244353
	k += 2
print(res % 998244353)


from sys import stdin

def main():
	n = int(input())
	aa = input().split()
	aad = [[int(ad) for ad in a] for a in aa]
	sums = []
	dcount = []
	for a in aad:
		l = len(a)
		for i in range(l):
			if i >= len(sums):
				sums.append(a[-i - 1])
				dcount.append(1)
			else:
				sums[i] += a[-i - 1]
				dcount[i] += 1
	digits = len(sums)
	sums += [0] * digits
	lencount = [dcount[n] - dcount[n + 1] for n in range(digits - 1)] + [dcount[-1]]
	sums2 = [0] * (digits * 2)
	for i in range(digits):
		sums2[i * 2] = sums[i] * dcount[i]
		sums2[i * 2 + 1] = sums[i] * dcount[i]
		for j in range(i):
			sums2[i * 2] += sums[i * 2 - j - 1] * lencount[j] * 2
			sums2[i * 2 + 1] += sums[i * 2 - j] * lencount[j] * 2
	res = 0
	for i in range(len(sums2) - 1, -1, -1):
		res = (sums2[i] + res * 10) % 998244353
	print(res)
main()


are = int(input())
dfhdsf = list(map(int, input().split()))
bre = []
zzre = len(str(dfhdsf[0]))
dfkhdjghdfd = [10 ** i for i in range(20)]
rre = 998244353
for i in dfhdsf:
	i = str(i)
	pre = 0
	qre = 0
	zre = 2 * zzre - 1
	z1re = 2 * zzre - 2
	for j in i:
		j = int(j)
		pre += j * dfkhdjghdfd[zre]
		qre += j * dfkhdjghdfd[z1re]
		zre -= 2
		z1re -= 2
	bre.append((pre + qre) % rre * are % rre)
result = 0
for i in bre:
	result += i % rre
print(result % rre)


n = int(input())
num = input().rstrip().split(' ')
ans = 0
length = [0 for _ in range(11)]
for k in num:
	length[len(k)] += 1
for i in num:
	check = len(i)
	for j in range(11):
		if check <= j:
			for l in range(check):
				ans += 11 * length[j] * int(i[check - l - 1]) * pow(10, 2 * l, 998244353)
				ans %= 998244353
		else:
			count = 0
			for u in range(check - (check - j)):
				ans += 11 * length[j] * int(i[check - u - 1]) * pow(10, count, 998244353)
				count += 2
				ans %= 998244353
			for v in range(check - (check - j), check):
				ans += 2 * length[j] * int(i[check - v - 1]) * pow(10, count, 998244353)
				count += 1
				ans %= 998244353
print(ans)


import sys
import array
data = sys.stdin.read().split()
nums = int(data.pop(0))
power = 1
powers = []
for x in range(50):
	powers.append(power * nums)
	power *= 10
	power %= 998244353
powers = array.array('q', powers)
total = 0
for number in data:
	power_index = 0
	for digit in reversed(number):
		total += int(digit) * powers[power_index]
		total %= 998244353
		total += int(digit) * powers[power_index + 1]
		total %= 998244353
		power_index += 2
print(total)


n = int(input())
a = []
a = input().split()
ilist = [n * int('0'.join(s) + '0') for s in a]
jlist = [n * int('0'.join(s)) for s in a]
res = sum(ilist) + sum(jlist)
print(res % 998244353)


def f(a, b):
	st = ''
	for (x, y) in zip(a, b):
		st += y + x
	return int(st)
n = int(input())
A = input().split(' ')
sum = 0
for x in A:
	sum = (sum + n * f(x, x) % 998244353) % 998244353
print(sum)


import sys
from collections import defaultdict

def main():
	n = int(input())
	a = list(map(int, input().split()))
	MOD = 998244353
	res = 0
	for i in range(n):
		curr = a[i]
		pow10 = 1
		while curr > 0:
			x = 0
			x = (x + curr % 10 * pow10 % MOD) % MOD
			pow10 *= 10
			x = (x + curr % 10 * pow10 % MOD) % MOD
			pow10 *= 10
			x = x * n % MOD
			res = (res + x) % MOD
			curr //= 10
	print(res)
main()


n = int(input())
a = [int(i) for i in input().split()]
m = 998244353
s = []
tot_sum = 0
for i in range(n):
	s1 = str(a[i])
	s2 = str(a[i])
	s3 = ''
	for k in range(len(s1)):
		s3 += s1[k] + s2[k]
	tot_sum += int(s3) % m
tot_sum *= n
print(tot_sum % m)


import math
n = int(input())
ar = input().split()
l = len(ar[0])
s = [0 for i in range(l)]
s2 = [0 for i in range(2 * l)]
for j in range(l):
	for i in range(n):
		s[j] += int(ar[i][j])
for j in range(2 * l):
	s2[j] = n * s[j // 2]
cost = 0
for j in range(2 * l):
	cost += s2[j] * pow(10, 2 * l - 1 - j)
print(cost % 998244353)


n = int(input())
a = input().split()
b = [[] for i in range(10)]
c = [[] for i in range(10)]
d = [0 for i in range(11)]
ans = 0
for i in a:
	b[len(i) - 1].append(i)
for i in range(9, -1, -1):
	d[i] = d[i + 1] + len(b[i])
for i in range(10):
	for j in b[i]:
		k = ''.join(map(''.join, zip(j, j)))
		c[i].append(k)
for i in range(10):
	for j in range(i, 10):
		for k in b[j]:
			idx = -i - 1
			l = int(''.join(map(''.join, zip(k[idx:], k[idx:]))))
			if i == j:
				ans = ans + d[i] * l
			else:
				ans = ans + len(b[i]) * l
				ans = ans + 2 * len(b[i]) * int(k[:idx]) * 10 ** (-idx * 2)
print(ans % 998244353)


n = int(input())
mod = 998244353
ans = 0
ai = input().split()
lengths = [0] * 11
for i in range(n):
	temp = len(ai[i])
	lengths[temp] += 1
tens = [0] * 25
for i in range(25):
	tens[i] = 10 ** i
for i in range(n):
	temp = len(ai[i])
	num = 0
	for j in range(temp, 11):
		num += lengths[j]
	for z in range(temp):
		ans += num * tens[z * 2] * int(ai[i][-z - 1])
		ans += num * tens[z * 2 + 1] * int(ai[i][-z - 1])
	ans %= mod
print(ans)


n = int(input().strip())
numbers = list(map(int, input().strip().split()))
numbervec = []
for k in range(n):
	num1 = numbers[k]
	nn = []
	while num1 > 0:
		nn.append(num1 % 10)
		num1 = num1 // 10
	numbervec.append(nn)
sss = 0
for tt in range(len(numbervec[0])):
	ss = 0
	for t in range(n):
		ss = (ss + numbervec[t][tt]) % 998244353
	ss = ss * n % 998244353
	ss = ss * 11 * pow(10, 2 * tt, 998244353) % 998244353
	sss = (sss + ss) % 998244353
print(sss)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def F(sai, saj):
	p = len(sai)
	q = len(saj)
	z = ''
	if p >= q:
		for t in range(p - q):
			z += sai[t]
		for t in range(q):
			z += sai[t + p - q]
			z += saj[t]
	else:
		for t in range(q - p):
			z += saj[t]
		for t in range(p):
			z += sai[t]
			z += saj[t + q - p]
	c = 1
	r = []
	for i in range(len(z)):
		if z[i] != 'a':
			r.append(len(z) - 1 - i)
	return r
f = []
u = 1
for i in range(23):
	f.append(u % 998244353)
	u *= 10

def cont(r, k):
	c = 0
	for i in range(len(k) - 1, -1, -1):
		c += f[r[i]] * int(k[i])
		c %= 998244353
	return c

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		a = ria()
		cnt = [0] * 11
		for i in a:
			cnt[len(str(i))] += 1
		d = {}
		for i in range(11):
			if cnt[i]:
				d[i] = 1
		k = []
		g = []
		memo = {}
		for i in range(11):
			k.append('a' * i)
			g.append('b' * i)
		for i in k:
			for j in g:
				memo[len(i), len(j), 0] = F(i, j)
				memo[len(j), len(i), 1] = F(j, i)
		ans = 0
		for i in a:
			e = str(i)
			for j in d:
				ans += cnt[j] * (cont(memo[len(k[j]), len(e), 0], e) + cont(memo[len(e), len(k[j]), 1], e)) % 998244353
		wi(ans % 998244353)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


md = 998244353
n = int(input())
a = list(map(int, input().split()))
sm = 0
for i in range(n):
	j = 1
	s = str(a[i])
	for k in range(len(s) - 1, -1, -1):
		sm = (sm + int(s[k]) * j) % md
		j *= 100
ans = 0
print(n * 11 * sm % md)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
m = len(str(a[0]))
MOD = 998244353
pow10 = [10 ** i % MOD for i in range(2 * m + 5)]
ans = 0
for i in range(n):
	k = str(a[i])
	for j in range(m):
		ans += n * pow10[2 * j] * int(k[m - j - 1])
		ans %= MOD
		ans += n * pow10[2 * j + 1] * int(k[m - j - 1])
		ans %= MOD
print(ans)


n = int(input())
arr = input().split()
arr = [int(el) for el in arr]
lh = len(str(arr[0]))
summ = 0
for el in arr:
	temp = el
	for i in range(lh):
		r = temp % 10 ** (2 * i)
		l = temp // 10 ** (2 * i)
		temp = l * 10 ** (2 * i + 1) + r
	summ += temp
	temp = el
	for i in range(1, lh):
		r = temp % 10 ** (2 * i - 1)
		l = temp // 10 ** (2 * i - 1)
		temp = l * 10 ** (2 * i) + r
	summ += temp
print(summ * n % 998244353)


from sys import stdin, stdout
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warmup = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys

class merge_find:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (digits - len(b)) + b
	return b

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def generate_primes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
factorial_modP = []

def warm_up_fac(MOD):
	global factorial_modP, fac_warmup
	if fac_warmup:
		return
	factorial_modP = [1 for _ in range(fac_warmup_size + 1)]
	for i in range(2, fac_warmup_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warmup = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	global fac_warmup, factorial_modP
	if not fac_warmup:
		warm_up_fac(MOD)
		fac_warmup = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def display_2D_list(li):
	for i in li:
		print(i)

def prefix_sum(li):
	sm = 0
	res = []
	for i in li:
		sm += i
		res.append(sm)
	return res

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
import heapq, itertools
pq = []
entry_finder = {}
REMOVED = '<removed-task>'

def add_task(task, priority=0):
	if task in entry_finder:
		remove_task(task)
	count = next(counter)
	entry = [priority, count, task]
	entry_finder[task] = entry
	heapq.heappush(pq, entry)

def remove_task(task):
	entry = entry_finder.pop(task)
	entry[-1] = REMOVED

def pop_task():
	while pq:
		(priority, count, task) = heapq.heappop(pq)
		if task is not REMOVED:
			del entry_finder[task]
			return task
	raise KeyError('pop from an empty priority queue')
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_serach(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = False
testingMode = False
fac_warmup_size = 10 ** 5 + 100
optimiseForReccursion = False
from math import factorial

def main():
	P = 998244353
	n = get_int()
	li = []
	for num in get_list():
		x = []
		while num != 0:
			x.append(num % 10)
			num = num // 10
		li.append(x)
	res = 0
	power = 1
	for index in range(len(li[0])):
		sm_digits = 0
		for i in range(len(li)):
			sm_digits += li[i][index]
		sm_digits = sm_digits % P * (len(li) % P) % P
		res += sm_digits * power % P
		res = res % P
		power = power * 10 % P
		res += sm_digits * power % P
		res = res % P
		power = power * 10 % P
	print(res)
if TestCases:
	for i in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


import random

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
ans = 0
mod = 998244353
n = int(input())
a = list(map(int, input().split()))
ten = 1
carry = 0
ans = ''
times = str(a[0])
for i in range(len(times)):
	ten *= 10
	t = 0
	for j in range(len(a)):
		t += a[j] % 10
		a[j] //= 10
	t *= n
	ans = str((t + carry) % 10) + ans
	carry = (t + carry) // 10
	ans = str((t + carry) % 10) + ans
	carry = (t + carry) // 10
if carry:
	ans = str(carry) + ans
ans = str(int(ans) % mod)
print(ans)


def dig_cnt(n):
	ans = 0
	while n >= 1:
		ans += 1
		n /= 10
	return ans
n = int(input())
arr = [int(x) for x in input().split()]
dig_count = [0 for _ in range(11)]
for i in arr:
	dig_count[dig_cnt(i)] += 1
ans = 0
mod = 998244353
for x in range(n):
	gv = str(arr[x])
	list_dig = []
	for i in gv:
		list_dig.append(i)
	list_dig = list_dig[::-1]
	digs = dig_cnt(arr[x])
	num = 0
	for i in gv:
		num = num * 10 + int(i)
		num = num * 10 + int(i)
	ans += num * dig_count[digs]
	for i in range(digs):
		if dig_count[i] == 0:
			continue
		(num1, num2) = ('', '')
		zeroth = [str(0) for _ in range(i)]
		p = 0
		while p < i:
			num1 += list_dig[p]
			num1 += zeroth[p]
			p += 1
		while p < digs:
			num1 += list_dig[p]
			p += 1
		p = 0
		while p < i:
			num2 += zeroth[p]
			num2 += list_dig[p]
			p += 1
		while p < digs:
			num2 += list_dig[p]
			p += 1
		num1 = num1[::-1]
		num2 = num2[::-1]
		ans += (int(num1) + int(num2)) * dig_count[i]
	for i in range(digs + 1, 11):
		if dig_count[i] == 0:
			continue
		(num1, num2) = ('', '')
		zeroth = [str(0) for _ in range(i)]
		p = 0
		while p < digs:
			num1 += list_dig[p]
			num1 += zeroth[p]
			p += 1
		num1 += '0'
		p = 0
		while p < digs:
			num2 += zeroth[p]
			num2 += list_dig[p]
			p += 1
		num2 += '0'
		num1 = num1[::-1]
		num2 = num2[::-1]
		ans += (int(num1) + int(num2)) * dig_count[i]
print(ans % mod)


prime = 998244353
n = int(input())
arr = list(input().split())
count = [0 for i in range(11)]
count2 = [0 for i in range(11)]
for i in arr:
	count[len(i)] += 1
for i in range(1, 11):
	count2[i] = count2[i - 1] + count[i]
ans = 0
for i in arr:
	place = 1
	k = 1
	for j in range(len(i) - 1, -1, -1):
		ans = (ans + (count2[10] - count2[k - 1]) * place * int(i[j])) % prime
		ans = (ans + (count2[10] - count2[k - 1]) * place * int(i[j]) * 10) % prime
		for l in range(1, k):
			ans = (ans + 2 * count[l] * pow(10, l + k - 1) * int(i[j])) % prime
		place = place * 100
		k += 1
print(ans)


n = int(input())
a = list(map(str, input().split()))
sz = len(a[0])
s = 0
m = 998244353
for i in range(n):
	x = 0
	for j in range(sz):
		x *= 100
		x += int(a[i][j])
	s += x
	s %= m
print(11 * n * s % m)


input()
a = list(map(int, input().split()))
cl = [0] * 10
for i in a:
	cl[len(str(i)) - 1] += 1
(ans, M) = (0, 998244353)
pad = lambda a, d: a % d + (a - a % d) * 10
for i in a:
	for (p, le) in enumerate(cl):
		ans = ans + i * 10 * le
		i = pad(i, 10 * 100 ** p)
		ans = ans + i * le
print(ans % M)


import sys
input = sys.stdin.readline

def main():
	N = int(input())
	A = list(map(int, input().split()))
	mod = 998244353
	max_l = 0
	Dig = [0] * 11
	for a in A:
		l = len(str(a))
		Dig[l - 1] += 1
		max_l = max(max_l, l)
	D = [0] * 21
	for a in A:
		l = len(str(a))
		for j in range(max_l):
			for k in range(l):
				n = int(str(a)[l - 1 - k])
				ck = Dig[j]
				if j >= k:
					D[k * 2] += ck * n % mod
					D[k * 2 + 1] += ck * n % mod
				else:
					D[j + k + 1] += 2 * ck * n % mod
	ans = 0
	for i in range(21):
		ans = (ans + D[i] % mod * (10 ** i % mod)) % mod
	print(ans)
main()


def gns():
	return list(map(int, input().split()))
n = int(input())
ns = input().split()

def db(x):
	ans = ''
	for c in x:
		ans += c * 2
	return ans
md = 998244353
ns = [int(db(x)) % md for x in ns]
sm = sum(ns)
print(sm * n % md)


prime = 998244353
from collections import defaultdict
from math import sqrt
t = 1
for test in range(t):
	n = int(input())
	arr = list(input().split())
	ans = 0
	for i in arr:
		place = 1
		for j in range(len(i) - 1, -1, -1):
			ans = (ans + n * place * int(i[j])) % prime
			ans = (ans + n * place * int(i[j]) * 10) % prime
			place = place * 100
	print(ans)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

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

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 998244353
yp = 0

def solve():
	t = 1
	for tt in range(t):
		n = nu()
		pre = [0] * n
		a = [0] * n
		ll = li()
		for i in range(n):
			x = str(ll[i])
			w = 1
			ss = 0
			w1 = 10
			for j in range(len(x) - 1, -1, -1):
				ss = (ss + int(x[j]) * w) % mm
				w = w * 100 % mm
				a[i] = (a[i] + int(x[j]) * w1) % mm
				w1 = w1 * 100 % mm
			pre[i] = ss
		for i in range(1, n):
			pre[i] = (pre[i - 1] + pre[i]) % mm
		op = (pre[n - 1] * n % mm + sum(a) * n % mm) % mm
		print(op)
solve()


n = int(input())
a = [i for i in input().split(' ')]
l = len(a[0])
dp = [0 for i in range(100005)]
ans = 0
mod = 998244353
for i in range(n):
	tmp = 0
	for j in range(l):
		tmp *= 100
		tmp += ord(a[i][j]) - ord('0')
	dp[i] = tmp * 10
for i in range(n):
	ans += dp[i] * n + dp[i] // 10 * n % mod
	ans %= mod
print(ans)


from sys import stdin
n = int(stdin.readline())
a = list((list((j for j in i)) for i in stdin.readline().split()))
b = list((0 for i in range(0, 10)))
for i in a:
	b[len(i) - 1] += 1
Ans = 0

def left(x, b):
	Sum = 0
	y = len(x)
	for i in range(0, 10):
		if b[i] == 0:
			continue
		X = x.copy()
		for j in range(0, i + 1):
			if y - j >= 0:
				X.insert(y - j, '0')
			else:
				break
		Sum += int(''.join(X)) * b[i]
	return Sum

def right(x, b):
	Sum = 0
	y = len(x)
	for i in range(0, 10):
		if b[i] == 0:
			continue
		X = x.copy()
		for j in range(0, i + 1):
			if y - j - 1 >= 0:
				X.insert(y - j - 1, '0')
			else:
				break
		Sum += int(''.join(X)) * b[i]
	return Sum
for x in a:
	Ans += left(x, b)
	Ans += right(x, b)
print(Ans % 998244353)


n = int(input())
a = list(map(str, input().split()))
mod = 998244353
ans = 0
for i in range(n):
	for j in range(len(a[i])):
		ans += int(a[i][len(a[i]) - j - 1]) * (10 ** (2 * j) + 10 ** (2 * j + 1))
		ans %= mod
print(ans * n % mod)


n = int(input())
a = list(map(str, input().split()))
l = len(a[0])
ans = [''] * (2 * l)
for i in range(l):
	an = 0
	for j in range(n):
		an += int(a[j][i])
	ans[2 * i] = n * an
	ans[2 * i + 1] = n * an
for i in range(2 * l - 1, 0, -1):
	ans[i - 1] = ans[i - 1] + ans[i] // 10
	ans[i] = str(ans[i] % 10)
ans[0] = str(ans[0])
print(int(''.join(ans)) % 998244353)


n = int(input())
A = list(input().split())
k = len(A[0])
answer = 0
for a in A:
	second_arg = 0
	for d in range(k):
		second_arg += 10 ** (d * 2) * int(a[k - d - 1])
	first_arg = 0
	for d in range(k):
		first_arg += 10 ** (d * 2 + 1) * int(a[k - d - 1])
	answer += n * (second_arg + first_arg)
	answer %= 998244353
print(answer)


mod = 998244353

def mrg(x):
	res = 0
	s = list(map(int, str(x)))
	for n in s:
		res *= 10
		res += n
		res %= mod
		res *= 10
		res += n
		res %= mod
	return res % mod
x = int(input())
s = list(map(int, input().split()))
res = 0
for n in s:
	res = (mrg(n) + res) % mod
print(res * x % mod)


n = int(input())
arr = list(map(str, input().split()))
l = len(arr[0])
mod = 998244353
ans = 0
modarr = [0] * (2 * l)
for i in range(2 * l):
	modarr[i] = 10 ** i % mod % mod
for s in arr:
	for i in range(l):
		tmp = int(s[i])
		ans += n * tmp * modarr[2 * l - 1 - 2 * i] % mod
		ans += n * tmp * modarr[2 * l - 2 - 2 * i] % mod
print(ans % mod)


n = int(input())
l = list(input().split())
c = len(l[0])
i = 0
z = 0
f = c
while i <= c * 2 - 1:
	s = 0
	for j in l:
		s += int(j[f - 1])
	s = s * n
	z += 10 ** (i + 1) * s % 998244353 + 10 ** i * s % 998244353
	f -= 1
	i += 2
print(z % 998244353)


N = int(input())
A = input().split()
m = len(A[0])
d = [0] * 10
d2 = [0] * 22
for i in range(m):
	for k in range(N):
		d[i] += ord(A[k][m - 1 - i]) - ord('0')
	d[i] *= N
for i in range(m):
	d2[2 * i] = d[i]
	d2[2 * i + 1] = d[i]
for i in range(2 * m):
	u = d2[i] // 10
	d2[i] = d2[i] % 10
	d2[i + 1] += u
ans = 0
for i in range(2 * m + 2):
	ans += d2[i] * 10 ** i
print(ans % 998244353)


mod = 1000000007
mod1 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = il()
lstr = [str(i) for i in l]
sl = len(str(l[0]))
ld = [0] * len(str(l[0]))
for i in range(sl):
	for j in range(n):
		ld[i] += int(lstr[j][i])
sm = 0
for i in lstr:
	for j in range(2 * sl):
		if j & 1:
			sm += ld[j // 2] * 10 ** (2 * sl - 1 - j)
		else:
			sm += int(i[j // 2]) * n * 10 ** (2 * sl - 1 - j)
print(sm % mod1)


n = int(input())
l = list(map(int, input().split()))
answer = 0
mod = 998244353
for val in l:
	itr = 0
	while val > 0:
		cur = val % 10
		val //= 10
		answer += n * cur * 10 ** itr % mod
		itr += 1
		answer += n * cur * 10 ** itr % mod
		itr += 1
		answer %= mod
print(answer)


n = int(input())
li = input().split(' ')
for x in range(n):
	li[x] = int(li[x])
mod = 998244353
tt = li[0]
cnt = 0
while tt > 0:
	cnt = cnt + 1
	tt = tt // 10
su = []
i = 0
while i < cnt:
	su.append(0)
	i = i + 1
for xx in li:
	jj = 0
	temp = xx
	while temp > 0:
		su[jj] = su[jj] + temp % 10
		temp = temp // 10
		jj = jj + 1
for yy in range(cnt):
	su[yy] = su[yy] * n
templist = []
carry = 0
for j in range(cnt):
	templist.append((su[j] + carry) % 10)
	carry = (su[j] + carry) // 10
	templist.append((su[j] + carry) % 10)
	carry = (su[j] + carry) // 10
while carry > 0:
	templist.append(carry % 10)
	carry = carry // 10
templist.reverse()
ans = 0
for xx in templist:
	ans = ans * 10 + xx
print(ans % mod)


mo = 998244353
n = int(input())
l = [int(s) for s in input().split()]
su = 0
for i in range(n):
	pre = 1
	re = l[i]
	while re > 0:
		temp = re % 10
		re = re // 10
		su += temp % mo * pre % mo * n
		su = su % mo
		pre = pre * 10
		pre = pre % mo
		su += temp % mo * pre % mo * n
		pre = pre * 10
		pre = pre % mo
		su = su % mo
print(su)


n = int(input())
a = input().split()
ans = 0
for i in a:
	k = int(''.join(map(''.join, zip(i, i))))
	ans = ans + n * k
print(ans % 998244353)


n = int(input())
a = list(map(int, input().split()))
x = a[0]
le = 0
fin = []
sums = []
for i in range(n):
	tt = []
	x = a[i]
	while x > 0:
		tt.append(x % 10)
		x //= 10
	fin.append(tt)
car = 0
ans = []
le = len(fin[0])
for i in range(le):
	sumi = 0
	for j in range(n):
		sumi += fin[j][i]
	sums.append(sumi)
for i in range(le):
	x = sums[i] * n
	y = x
	y += car
	if y > 9:
		car = y // 10
	else:
		car = 0
	ans.append(y % 10)
	x += car
	if x > 9:
		car = x // 10
	else:
		car = 0
	ans.append(x % 10)
if car > 0:
	ans.append(car)
fin = ''
for i in range(len(ans) - 1, -1, -1):
	fin += str(ans[i])
lst = int(fin)
print(lst % 998244353)


n = int(input())
num = input().rstrip().split(' ')
ans = 0
for i in num:
	check = len(i)
	for j in range(check):
		ans += 11 * n * int(i[check - j - 1]) * 10 ** (j * 2)
	ans %= 998244353
print(ans)


import sys
inf = float('inf')

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
mod = 998244353
n = int(input())
Arr = get_array()
result1 = []
result2 = []
for i in range(n):
	x = str(Arr[i])
	ans1 = ''
	ans2 = ''
	length = len(x)
	for j in range(length):
		ans1 += x[j]
		ans1 += '0'
	result1.append(int(ans1))
	result2.append(int(ans1[:-1]))
total = sum(result2)
final = 0
for i in range(n):
	final += result1[i] * n + total
final = final % mod
print(final)


def solve(t):
	s = []
	for i in range(len(t)):
		s.append(t[i])
		s.append(t[i])
	s = int(''.join(s)) % 998244353
	return s
res = 0
n = int(input())
a = list(map(int, input().split(' ')))
for i in range(n):
	t = str(a[i])
	s = solve(t)
	res += n * s
print(res % 998244353)


from sys import stdin, stdout, exit
mod = 998244353
n = int(input())
a = list(map(int, stdin.readline().split()))
ans = 0

def space_out(x):
	ans = []
	for c in str(x):
		ans.append(c)
		ans.append('0')
	return int(''.join(ans[:-1]))
for i in range(n):
	x = a[i]
	ans += n * 11 * space_out(x)
	ans %= mod
stdout.write(str(ans) + '\n')


from collections import Counter
MOD = 998244353
n = int(input())
a = [int(w) for w in input().split()]

def pad(x, k):
	e = 1
	r = 0
	while x > 0:
		r += e * (x % 10)
		x //= 10
		e *= 100 if k > 0 else 10
		k -= 1
	return r

def digits(x):
	r = 0
	while x > 0:
		r += 1
		x //= 10
	return r
r = 0
for (digits, count) in Counter(map(digits, a)).items():
	for x in a:
		r = (r + count * (pad(x, digits) + 10 * pad(x, digits - 1))) % MOD
print(r)


n = int(input())
l = list(map(str, input().split()))
m = 998244353
ans = 0
for i in range(n):
	s = ''
	for j in range(len(l[i])):
		s += '0'
		s += l[i][j]
	ans = (ans + int(s)) % m
ans = ans * n % m
k = ans * 10 % m
ans = (ans + k) % m
print(ans % m)


n = int(input())
a = list(map(str, input().split()))

def func(x, y):
	ln = len(y)
	s = ''
	for i in range(ln):
		s = s + x[i] + y[i]
	return int(s)
num = 0
for i in range(n):
	num += func(a[i], a[i])
print(num * n % 998244353)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
MOD = 998244353

def pads(x, k):
	(e, r) = (1, 0)
	while x > 0:
		(x, m) = divmod(x, 10)
		r += e * m
		e *= [10, 100][k > 0]
		k -= 1
	return r % MOD
nb = RI()
arr = RMI()
lcnt = [0] * 11
for i in arr:
	lcnt[len(str(i))] += 1
r = 0
for j in range(1, 11):
	for i in range(nb):
		r = (r + lcnt[j] * (pads(arr[i], j) + 10 * pads(arr[i], j - 1))) % MOD
print(r)


def cal(x):
	x = str(x)
	y = str(x)
	k = [0] * (2 * len(x))
	m = 0
	n = 0
	for i in range(2 * len(x)):
		if i % 2 == 0:
			k[i] = x[m]
			m += 1
		else:
			k[i] = y[n]
			n += 1
	return int(''.join(k))
n = int(input())
l = list(map(int, input().split()))
m = 998244353
ans = 0
for i in range(n):
	z = cal(l[i])
	ans = (ans % m + z % m) % m
print(n % m * ans % m % m)


from collections import Counter
b = 998244353
n = int(input())
arr = input().split()
mp = list(map(lambda x: len(x), arr))
cnt = Counter(mp)
s = 0
for a in arr:
	l = list(reversed(a))
	for (num, ln) in cnt.items():
		l1 = int(''.join(list(reversed(['%s0' % x if i < num else x for (i, x) in enumerate(l)]))))
		l2 = int(''.join(list(reversed(['0%s' % x if j < num else x for (j, x) in enumerate(l)]))))
		s = (s + l1 * ln) % b
		s = (s + l2 * ln) % b
print(s)


MOD = 998244353
n = int(input())
L = list(input().split())
ans = 0
d = len(L[0])
for k in range(d):
	t = 0
	for e in L:
		t += n * int(e[-k - 1])
	ans += t * 10 ** (2 * k)
	ans %= MOD
	ans += t * 10 ** (2 * k + 1)
	ans %= MOD
print(ans)


MOD = 998244353
n = int(input())
a = [int(w) for w in input().split()]

def pad(x, k):
	e = 1
	r = 0
	while x > 0:
		r += e * (x % 10)
		x //= 10
		e *= 100 if k > 0 else 10
		k -= 1
	return r
r = 0
for x in a:
	r = (r + pad(x, 57)) % MOD
print(r * n * 11 % MOD)


print(11 * int(input()) * sum(map(int, '0'.join(input()).split('0 0'))) % 998244353)


mod = 998244353
n = int(input())
a = list(map(int, input().split()))
sum = 0
ten = []
keep = 1
ten.append(keep)
for i in range(1, 30):
	keep *= 10
	ten.append(keep)
for i in a:
	copy = i
	cur = 0
	while copy > 0:
		digit = copy % 10
		copy //= 10
		digit *= n
		sum += digit * ten[cur]
		cur += 1
		sum += digit * ten[cur]
		cur += 1
print(sum % mod)


from math import log
M = 998244353

def op(n):
	out = 0
	if n == 0:
		return 0
	d = int(log(n, 10)) + 1
	for i in range(d):
		out += 11 * 10 ** (2 * i) * (n % 10) % M
		n //= 10
	return out
n = int(input())
a = [int(x) for x in input().split()]
dig = [int(log(x, 10)) + 1 for x in a]
cntdig = [0] * 11
for l in dig:
	cntdig[l] += 1
ans = 0
for ai in a:
	d = int(log(ai, 10)) + 1
	for d_o in range(1, 11):
		if d_o > d:
			ans += cntdig[d_o] * op(ai)
			ans %= M
		elif d_o == d:
			ans += cntdig[d_o] * op(ai)
		else:
			ans += cntdig[d_o] * op(ai % 10 ** d_o)
			ans += 2 * cntdig[d_o] * (ai // 10 ** d_o) * 10 ** (2 * d_o)
			ans %= M
print(ans % M)


def power(x, y, p):
	res = 1
	x = x % p
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
m = 998244353
t = int(input(''))
a = list(map(int, input().split()))
c = []
b = []
for i in range(t):
	b = []
	while a[i] != 0:
		b.append(a[i] % 10)
		a[i] = a[i] // 10
	c.append(b)
ans = 0
for j in range(len(b)):
	k = 0
	for i in range(len(a)):
		k += c[i][j]
	for kk in range(2):
		f = j * 2 + kk
		ans = (ans % m + k % m * (t % m) * (pow(10, f, m) % m) % m) % m
print(ans)


n = int(input())
a = list(input().split())
b = []
k = len(a[0])
for i in range(k):
	q = 0
	for j in range(n):
		q += int(a[j][i])
	b.append(n * q)
	b.append(n * q)
s = ''
for k in range(len(b) - 1, 0, -1):
	s = str(b[k] % 10) + s
	b[k - 1] += b[k] // 10
s = str(b[0]) + s
print(int(s) % 998244353)


M = 998244353
N = int(input())
List = [x for x in input().split()]
Len = len(List[0])
X = [0] * (Len * 2 + 1)
for i in range(N):
	for j in range(1, Len * 2, 2):
		X[j] += int(List[i][int(j // 2)]) * N
	for j in range(2, Len * 2 + 1, 2):
		X[j] += int(List[i][int(j // 2) - 1]) * N
Ans = 0
carry = 0
LEN = Len << 1
for i in range(LEN, 0, -1):
	currAns = int(carry) + X[i]
	LastDigit = str(currAns)[-1]
	carry = str(currAns)[:-1]
	if not carry:
		carry = 0
	Ans += int(LastDigit) * 10 ** (LEN - i) % M
	Ans %= M
if int(carry):
	carry = int(carry) * 10 ** LEN
	Ans = carry + Ans
	Ans %= M
print(Ans % M)


n = int(input())
v = list(map(int, input().split()))
a = []
b = []
for i in v:
	a_ = ''
	b_ = ''
	for x in str(i):
		a_ += x + '0'
		b_ += '0' + x
	a.append(int(a_))
	b.append(int(b_))
MOD = 998244353
f = 0
for (i, x) in enumerate(a):
	f = (f + x + b[i]) % MOD
print(n * f % MOD)


n = int(input())
mod = 998244353
ans = 0
arr = list(map(int, input().split(' ')))
for i in range(n):
	x = arr[i]
	curr = str(x)
	req1 = curr[0]
	for j in range(1, len(curr)):
		req1 += '0'
		req1 += curr[j]
	req2 = req1 + '0'
	v1 = int(req2)
	v2 = int(req1)
	v1 = v1 % mod * (n % mod) % mod
	v2 = v2 % mod * (n % mod) % mod
	ans = (ans % mod + v1 % mod) % mod
	ans = (ans % mod + v2 % mod) % mod
print(ans)


def submarine(n, arr):
	sum = 0
	for num in arr:
		for (i, ch) in enumerate(reversed(str(num))):
			x = int(ch)
			sum += x * n * 10 ** (i * 2) + n * x * 10 ** (i * 2 + 1)
	return sum
n = int(input())
arr = [int(x) for x in input().split(' ')]
print(submarine(n, arr) % 998244353)


import sys
n = int(sys.stdin.readline().strip())
a = sys.stdin.readline().strip().split()
k = len(str(a[0]))
A = [0] * k
for i in range(0, n):
	for j in range(0, k):
		A[j] = A[j] + int(a[i][j])
s = 0
for j in range(0, k):
	s = (s + 11 * 100 ** (k - j - 1) * A[j]) % 998244353
print(s * n % 998244353)


n = int(input())
s = 0
mod = 998244353
l = input().split()
for i in l:
	s = (s + int('0'.join(list(i))) % mod) % mod
s = s * (n * 11 % mod) % mod
print(s)


import sys

def input():
	return sys.stdin.readline().strip()

def dinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(str, tinput())

def rt(a, s):
	t = ''
	z = 0
	x = len(a)
	y = len(s)
	while z < x and z < y:
		t = t + a[z] + s[z]
		z += 1
	print(y, x, t)
	if y > x:
		t = t + s[z:]
	else:
		t = t + a[z:]
	return int(t)

def main():
	n = dinput()
	q = list(rinput())
	w = {}
	ans = 0
	for i in q:
		if len(i) not in w:
			w[len(i)] = 1
		else:
			w[len(i)] = w[len(i)] + 1
	for i in range(n):
		y = ''
		x = ''
		for j in range(1, 11):
			c = q[i]
			if len(c) > j:
				a = c[0:len(c) - j]
			else:
				a = ''
			if len(c) - j >= 0:
				y = '0' + c[len(c) - j] + y
				x = c[len(c) - j] + '0' + x
			l = a + y
			r = a + x
			if j in w:
				ans += int(l) * w[j]
				ans += int(r) * w[j]
	print(ans % 998244353)
main()


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
l = [len(str(i)) for i in a]
c = Counter(l)
cl = [c[i] for i in range(1, 11)]
M = 998244353
pad = lambda a, d: a % d + (a - a % d) * 10
ans = 0
for i in a:
	il = len(str(i))
	t = i
	for p in range(10):
		i = pad(i, 100 ** p)
		ans = (ans + i * cl[p]) % M
	i = t
	for p in range(10):
		i = pad(i, 10 * 100 ** p)
		ans = (ans + i * cl[p]) % M
print(ans)


MOD = 998244353

def len(x):
	res = 0
	while x > 0:
		(x, res) = (x // 10, res + 1)
	return res

def solve(x, tpow10, i):
	(res, sec0, sec1, pow10) = (0, 0, 0, 1)
	while x > 0:
		sec0 += pow10 * (x % 10)
		sec1 = (sec1 + tpow10 * (x % 10)) % MOD
		x //= 10
		tmp = (x * tpow10 * 10 + sec1) % MOD
		res += cnt_len[i] * tmp % MOD
		i += 1
		pow10 = pow10 * 10 % MOD
		tpow10 = tpow10 * 100 % MOD
	while i < 11:
		res += sec1 * cnt_len[i] % MOD
		i = i + 1
	return res % MOD
n = int(input())
a = list(map(int, input().split()))
cnt_len = [0] * 11
ans = 0
for i in range(n):
	cnt_len[len(a[i])] += 1
for i in range(n):
	ans += solve(a[i], 10, 1) + solve(a[i], 1, 0)
print(ans % MOD)


n = int(input())
arr = list(map(int, input().split()))
mod = 998244353
ans = 0
for i in range(n):
	s1 = str(arr[i])
	count = 0
	for j in s1[::-1]:
		num = int(j)
		val = n * num % mod
		ans = (ans + pow(10, count, mod) * val % mod) % mod
		ans = (ans + pow(10, count + 1, mod) * val % mod) % mod
		count += 2
print(ans)


MOD = 998244353
num = [[] for i in range(12)]
powx = [10 ** i for i in range(20)]
n = int(input())
x = list(map(int, input().split()))
for a in x:
	digit = len(str(a))
	num[digit].append(a)
ans = 0
for d1 in range(1, 12):
	for x in num[d1]:
		i = 0
		while x != 0:
			xi = x % 10
			for d2 in range(1, d1):
				if i < d2:
					tmp = (len(num[d2]) * xi * powx[2 * i] + len(num[d2]) * xi * powx[2 * i + 1]) % MOD
				else:
					tmp = (len(num[d2]) * xi * powx[i + d2] + len(num[d2]) * xi * powx[i + d2]) % MOD
				ans = (ans + tmp) % MOD
			tmp = (len(num[d1]) * xi * powx[2 * i + 1] + len(num[d1]) * xi * powx[2 * i]) % MOD
			ans = (ans + tmp) % MOD
			for d2 in range(d1 + 1, 12):
				tmp = (len(num[d2]) * xi * powx[2 * i] + len(num[d2]) * xi * powx[2 * i + 1]) % MOD
				ans = (ans + tmp) % MOD
			x //= 10
			i += 1
print(ans)


def MI():
	return map(int, input().split())

def I():
	return int(input())

def LI():
	return [int(i) for i in input().split()]
from collections import defaultdict
d = defaultdict(int)
mo = 998244353
n = I()
a = LI()
ans = 0
for i in range(n):
	d = 0
	t = 0
	for k in list(str(a[i]))[::-1]:
		j = int(k)
		t += n * 11 * j * 10 ** d
		t %= mo
		d += 2
	ans += t
	ans %= mo
print(ans)


import math
import heapq, bisect
import sys
from collections import deque
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def __init__(self, data, default=9999999, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
n = int(input())
l = list(map(int, input().split()))
d = dict()
cd = dict()
for i in range(n):
	c = countdig(l[i])
	if l[i] not in cd:
		cd.update({l[i]: c})
	if c in d:
		d[c] += 1
	else:
		d.update({c: 1})
tot = 0
for i in range(n):
	r = cd[l[i]]
	cop = l[i]
	for j in d:
		ans = 0
		if d[j] == 0:
			continue
		else:
			re = 10
			c = 1
			w = j - 1
			t = 1
			w1 = j
			t1 = 0
			for k in range(r):
				ans = (ans + l[i] % re * pow(10, c - 1 + t, mod1) % mod1) % mod1
				ans = (ans + l[i] % re * pow(10, c - 1 + t1, mod1) % mod1) % mod1
				if w > 0:
					w -= 1
					t += 1
				if w1 > 0:
					w1 -= 1
					t1 += 1
				c += 1
				l[i] //= 10
			tot += ans % mod1 * (d[j] % mod1)
			tot %= mod1
			l[i] = cop
print(tot % mod1)


n = int(input())
a = list(map(int, input().split()))
p = 0
ans = 0
while a[0]:
	for i in range(n):
		x = a[i] % 10
		ans = (ans + (10 * x + x) * n * 10 ** p) % 998244353
		a[i] = a[i] // 10
	p = p + 2
print(ans % 998244353)


import sys
from collections import deque
IS_LOCAL = False

def read_one(dtype=int):
	return dtype(input())

def read_multiple(f, dtype=int):
	return f(map(dtype, input().split()))

def swap(x, y):
	return (y, x)

def main():
	n = 3
	a = [12, 33, 45]
	if not IS_LOCAL:
		n = read_one()
		a = read_multiple(list)
	d = 998244353
	(s, k) = (0, 1)
	while a[0] > 0:
		for i in range(n):
			t = a[i] % 10
			a[i] //= 10
			s = (s + t * n * k * k * 11) % d
		k *= 10
	print(s)
if len(sys.argv) > 1 and sys.argv[1] == 'True':
	IS_LOCAL = True
main()


def my_pow(cur):
	ans = 1
	for _ in range(cur):
		ans *= 10
	return ans
mod = 998244353
n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in a:
	copy = i
	cur = 0
	while copy > 0:
		digit = copy % 10
		copy //= 10
		digit *= n
		sum += digit * pow(10, cur)
		cur += 1
		sum += digit * pow(10, cur)
		cur += 1
		sum %= mod
print(sum % mod)


n = int(input())
ad = [0] * 10
l = -1
for num in input().split():
	if l < 0:
		l = len(num)
	for i in range(l):
		ad[i] += ord(num[i]) - ord('0')
mod = 998244353
ans = 0
for x in range(l):
	ans = (ans * 100 + n * 11 * ad[x]) % mod
print(ans)


n = int(input())
l = input().split()
ans = 0
for i in l:
	temp = ''
	for j in i:
		temp += j + j
	ans += int(temp) % 998244353
print(ans * n % 998244353)


n = int(input())
l = list(map(str, input().split()))
m = 998244353
ans = 0
a = len(l[0])
for i in l:
	c = 0
	x = 0
	for j in range(a - 1, -1, -1):
		x += n * 10 ** c * int(i[j])
		c += 2
		x %= m
	ans += x
	ans %= m
	c = 1
	x = 0
	for j in range(a - 1, -1, -1):
		x += n * 10 ** c * int(i[j])
		c += 2
		x %= m
	ans += x
	ans %= m
print(ans)


MOD = 998244353
n = int(input())
a = list(map(int, input().split()))
digits = [0] * 20
for i in range(n):
	st = [int(i) for i in str(a[i])][::-1]
	for j in range(len(st)):
		digits[2 * j] += n * st[j]
		digits[2 * j + 1] += n * st[j]
		digits[2 * j] %= MOD
		digits[2 * j + 1] %= MOD
total = 0
for i in range(20):
	total = (total + digits[i] * 10 ** i) % MOD
print(total)


n = int(input())
l = list(map(int, input().split()))
cnt = [0] * 26
amount = [0] * 26
steps = [0] * 26
steps[0] = 1
ans = 0
mod = 998244353
for i in range(n):
	num = ''
	use = str(l[i])
	for j in range(len(str(l[i]))):
		if j != len(str(l[i])) - 1:
			num += use[j]
			num += '0'
		else:
			num += use[j]
	l[i] = int(num)
	amount[len(str(l[i]))] += 1
	cnt[len(str(l[i]))] += l[i] % mod
	cnt[len(str(l[i]))] %= mod
for i in range(n):
	for j in range(len(str(l[i])), len(str(l[i])) + 1):
		cur = l[i] % mod
		cur *= 10
		cur *= amount[j]
		cur %= mod
		cur %= mod
		cur += cnt[j]
		cur %= mod
		ans += cur
		ans %= mod
	ans %= mod
print(ans)


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = 1
mod = 998244353

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	l1 = [0 for j in range(10)]
	for i in range(n):
		x = l[i]
		j = 0
		while x:
			l1[j] += x % 10
			x //= 10
			j += 1
	for j in range(10):
		l1[j] *= n
	suma = 0
	mul = 1
	for j in range(10):
		for i in range(2):
			suma = (suma % mod + mul % mod * (l1[j] % mod) % mod) % mod
			mul = mul % mod * 10 % mod % mod
	return suma % mod
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(solve())


from sys import stdin, stdout, exit
mod = 998244353
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
ans = 0

def l(x):
	if x == 0:
		return 0
	return 1 + l(x // 10)
lens = [0] * 15
for x in a:
	lens[l(x)] += 1

def space_out(x, l):
	ans = []
	for (i, c) in enumerate(reversed(str(x))):
		ans.append(c)
		if i < l:
			ans.append('0')
	return int(''.join(reversed(ans)))
for i in range(n):
	x = a[i]
	cur_head = x // 10
	cur = x
	prev = x
	for l in range(11):
		if l > 0:
			ans += lens[l] * (cur + 10 * prev)
			ans %= mod
		prev = cur
		cur -= cur_head * 10 ** (2 * l + 1)
		cur += cur_head * 10 ** (2 * l + 2)
		cur_head //= 10
stdout.write(str(ans) + '\n')


MOD = int(998244353)

def change(s):
	n = int(0)
	for i in s:
		n = n * 100 + int(i)
		n = n % MOD
	return n
result = int(0)
n = int(input())
l = list(map(str, input().split(' ')))
for i in range(n):
	number = l[i]
	result += change(number)
	result = result % MOD
result = 11 * n * result
result = result % MOD
print(result)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
inf = float('inf')
from functools import cmp_to_key
from collections import defaultdict as dd
from collections import Counter, deque
from heapq import *
import math
from math import floor, ceil, sqrt

def geti():
	return map(int, input().strip().split())

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

def getis():
	return map(str, input().strip().split())

def getls():
	return list(map(str, input().strip().split()))

def gets():
	return input().strip()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	n = geta()
	a = getl()
	ans = 0
	mod = 998244353
	count = dd(int)
	for i in a:
		count[len(str(i))] += 1
	for i in a:
		for j in count:
			new = ''
			now = str(i)
			index = len(now) - 1
			other = ''
			for zero in range(j):
				if index == -1:
					break
				other = now[index] + other
				other = '0' + other
				new = '0' + new
				new = now[index] + new
				index -= 1
			while index != -1:
				new = now[index] + new
				other = now[index] + other
				index -= 1
			ans += int(new) * count[j]
			ans %= mod
			ans += int(other) * count[j]
			ans %= mod
	print(ans)
solve()


mod = 998244353

def count_digits(x):
	return len(str(x))
n = int(input())
a = [int(x) for x in input().split(' ')]
digs = [0] * 11
ans = 0
for ai in a:
	digs[count_digits(ai)] += 1
for ai in a:
	x = ai
	g = 1
	for d in range(1, 11):
		x = x % g + x // g * 10 * g
		g *= 100
		ans = (ans + digs[d] * x % mod) % mod
	x = ai
	g = 10
	for d in range(1, 11):
		x = x % g + x // g * 10 * g
		g *= 100
		ans = (ans + digs[d] * x % mod) % mod
print(ans)


M = 998244353
n = int(input())
a = [int(x) for x in input().split()]
l = len(str(a[0]))
ans = 0
for i in range(l + 1):
	for j in range(len(a)):
		ans += 10 ** (2 * i) * (a[j] % 10) % M
		a[j] //= 10
print(n * 11 * ans % M)


pri = 998244353
a = int(input())
z = list(map(int, input().split()))
total = 0
for i in range(len(z)):
	m = str(z[i])
	for i in range(len(m) - 1, -1, -1):
		x = len(m) - 1 - i
		x = 2 * x
		total += (int(m[i]) * pow(10, x, pri) + int(m[i]) * pow(10, x + 1, pri)) * a
		total %= pri
print(total)


n = int(input().strip())
arr = input().strip().split()
digs = []
l = len(str(arr[0]))
ans = 0
m = 1
for i in range(l - 1, -1, -1):
	total = 0
	for j in range(n):
		total += int(arr[j][i])
	ans += total * n * m + total * n * (m * 10)
	m *= 100
print(ans % 998244353)


def line(conv=int, fl=0):
	inp = input().split()
	if len(inp) == 1 and (not fl):
		return conv(inp[0])
	return map(conv, inp)
n = line()
a = [list(map(int, s)) for s in input().split()]
L = 998244353
l = len(a[0])

def cool_sum(it):
	q = 0
	for w in it:
		q = (q + w) % L
	return q
print(n * cool_sum((11 * 10 ** (i * 2) * sum((a[j][-i - 1] for j in range(n))) for i in range(l))) % L)


MOD = 998244353
n = int(input())
r = input().split()
s = 0
for t in r:
	p = 0
	for d in t:
		p = (p * 100 + int(d)) % MOD
	s += p
	s %= MOD
print(11 * n * s % MOD)


def F(sai, saj):
	p = len(sai)
	q = len(saj)
	if p >= q:
		z = ''
		for t in range(p - q):
			z += sai[t]
		for t in range(q):
			z += sai[t + p - q]
			z += saj[t]
	else:
		z = ''
		for t in range(q - p):
			z += saj[t]
		for t in range(p):
			z += sai[t]
			z += saj[t + q - p]
	c = 1
	r = 0
	for i in range(len(z) - 1, -1, -1):
		if z[i] != 'a':
			r += c * int(z[i])
		c *= 10
	return r
n = int(input())
a = [int(x) for x in input().split()]
cnt = [0] * 11
for i in a:
	cnt[len(str(i))] += 1
d = {}
for i in range(11):
	if cnt[i]:
		d[i] = 1
k = []
for i in range(11):
	k.append('a' * i)
ans = 0
for i in a:
	for j in d:
		ans += cnt[j] * (F(k[j], str(i)) + F(str(i), k[j])) % 998244353
print(ans % 998244353)


import io, sys
input = lambda f=io.StringIO(sys.stdin.buffer.read().decode()).readline: f().rstrip()
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
MOD = 998244353
pow10 = [10 ** i % MOD for i in range(21)]
n = ii()
a = li()
rec = [0] * 11
cnt = [0] * 11
for x in a:
	i = -1
	while x:
		i += 1
		rec[i] += pow10[2 * i + 1]
		x //= 10
	cnt[i] += 1
	j = 2 * i + 1
	while i < 10:
		i += 1
		j += 1
		rec[i] += pow10[j]
suf = [0] * 12
for i in range(10, -1, -1):
	suf[i] = suf[i + 1] + cnt[i]
ans = 0
for x in a:
	i = -1
	while x:
		i += 1
		d = x % 10
		ans += rec[i] * d
		ans += d * pow10[2 * i] * suf[i] % MOD
		x //= 10
		ans += x * pow10[2 * i + 2] * cnt[i] % MOD
	ans %= MOD
print(ans)


import itertools

def F(s):
	a = ''
	for i in s:
		a += i * 2
	return int(a)
n = int(input())
a = input().split()
print(sum(list(map(F, a))) * n % 998244353)


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter()
for ai in a:
	l = len(str(ai))
	c[l] += 1
res = 0
mod = 998244353
for ai in a:
	s = str(ai)
	l = len(s)
	for (key, value) in c.items():
		if key >= l:
			eq = '0'.join(s)
			res = (res + int(eq) * value) % mod
			eq = '0'.join(s) + '0'
			res = (res + int(eq) * value) % mod
		else:
			eq = []
			for i in range(l - key, l):
				eq.append(s[i] * 2)
			eq = [s[:-key]] + eq
			eq = ''.join(eq)
			res = (res + (int(eq) + int(s[:-key] + '0' * 2 * key)) * value) % mod
print(res)


n = int(input())
a = []
m = 998244353
for i in input().strip().split(' '):
	t = ''
	for x in i:
		t += x * 2
	a.append(int(t))
ans = 0
for i in a:
	ans = (ans + i * n) % m
print(ans % m)


n = int(input())
a = list(input().split())
total = 0
for num in a:
	new = ''
	for digit in num:
		new += 2 * digit
	total = (total + n * int(new)) % 998244353
print(total)


n = int(input())
a = list(map(str, input().split()))
sizes = [0] * 10
MOD = 998244353
for i in range(n):
	sizes[len(a[i]) - 1] += 1
dp = [0] * 10
for i in range(10):
	for j in range(10):
		if i <= j:
			dp[i] = (dp[i] + 11 * sizes[j] * 10 ** i % MOD * 10 ** i) % MOD
		else:
			dp[i] = (dp[i] + 20 * sizes[j] * 10 ** i % MOD * 10 ** j) % MOD
ans = 0
for i in range(n):
	for j in range(len(a[i])):
		l = len(a[i]) - j - 1
		ans = (ans + dp[l] * int(a[i][j])) % MOD
print(ans)


def ft(x):
	res = ''
	s = str(x)
	for i in s:
		res += i
		res += '0'
	return int(res)

def st(x):
	res = ''
	s = str(x)
	res += s[0]
	for i in s[1:]:
		res += '0'
		res += i
	return int(res)
n = int(input())
a = [int(i) for i in input().split()]
mod = 998244353
res = 0
for i in a:
	res += ft(i) % mod * n % mod
	res += st(i) % mod * n % mod
print(res % mod)


N = int(input())
nums = [int(x) for x in input().split()]
res = int()
for x in nums:
	s = str(x)
	s2 = str()
	for char in s:
		s2 += char + char
	res = res + int(s2)
res *= N
print(res % 998244353)


from sys import stdin, stdout
N = int(input())
arr1 = [int(x) for x in stdin.readline().split()]
L = len(str(arr1[0]))
res = 0
for i in range(N):
	digit = [int(x) for x in str(arr1[i])]
	for i in range(L):
		A = 10 ** (2 * L - 2 * i - 1)
		B = 10 ** (2 * L - 2 * i - 2)
		res += N * digit[i] * (A + B)
print(res % 998244353)


mod = 998244353
pws = [1]
for i in range(1, 22):
	pws.append(pws[i - 1] * 10)
n = int(input())
h = list(map(int, input().split()))
a = [[] for i in range(n)]
for i in range(n):
	x = h[i]
	while x:
		a[i].append(x % 10)
		x = x // 10
cnt = [0] * 11
for i in range(n):
	cnt[len(a[i])] += 1
s = 0
for i in range(n):
	for j in range(len(a[i])):
		cur = 0
		for k in range(1, j):
			s = (s + a[i][j] * pws[j + k] * cnt[k]) % mod
			cur += cnt[k]
		s = (s + a[i][j] * pws[2 * j] * (n - cur)) % mod
		cur = 0
		for k in range(1, j + 1):
			s = (s + a[i][j] * pws[j + k] * cnt[k]) % mod
			cur += cnt[k]
		s = (s + a[i][j] * pws[2 * j + 1] * (n - cur)) % mod
print(s)


n = int(input())
sum = 0
line = input().split()
for i in range(0, n):
	n1 = ''
	n2 = ''
	for ch in list(line[i]):
		n1 = n1 + '0' + ch
		n2 = n2 + ch + '0'
	sum = sum + int(n1) + int(n2)
	sum %= 998244353
sum = sum * n % 998244353
print(sum)


n = int(input())
question = input().split()
number = 0
for i in range(n):
	question[i] = list(map(int, list(question[i])))
j = 0
transposed = [[], [], [], [], [], [], [], [], [], []]
while j <= 9:
	for i in range(n):
		try:
			transposed[j].append(question[i][-j - 1])
		except IndexError:
			pass
	j += 1
max_digits = 0
for i in range(10):
	if not transposed[i]:
		max_digits = i
		break
else:
	max_digits = 10
for i in range(max_digits):
	temp_sum = sum(transposed[i])
	number += 10 ** (2 * i) * 11 * len(transposed[i]) * temp_sum
	if i > 0:
		j = 1
		while j <= 9:
			if i >= j:
				number += 10 ** (2 * i + 1 - j) * (2 * (len(transposed[i - j]) - len(transposed[i - j + 1]))) * temp_sum
			j += 1
print(number % 998244353)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math
MOD = 998244353
n = getN()
nums = getList()
nums.sort()
digits = len(str(nums[0]))
ans = 0

def anaaki(nstr):
	res = 0
	for (i, s) in enumerate(nstr[::-1]):
		res += int(s) * 10 ** (i * 2)
	return res
for (idx, num) in enumerate(nums):
	nstr = str(num)
	ret = anaaki(nstr) % MOD
	ans += ret * 11 * n
	ans = ans % MOD
print(ans)


mod = 998244353
pows = [0 for i in range(100)]
pows[0] = 1
for i in range(1, 100):
	pows[i] = pows[i - 1] * 10 % mod
n = int(input())
ans = 0
freq = [0 for i in range(15)]
v = ['' for i in range(n)]
line = input().split()
for i in range(n):
	v[i] = line[i]
	freq[len(v[i])] += 1
for x in v:
	for sz in range(1, 12):
		p = 0
		it = 0
		for i in range(len(x) - 1, -1, -1):
			y = ord(x[i]) - ord('0')
			num = pows[p] % mod
			num = num * y % mod
			num = num * freq[sz] % mod
			ans = (ans + num) % mod
			if it < sz:
				p += 2
			else:
				p += 1
			it += 1
	for sz in range(1, 12):
		p = 1
		it = 1
		for i in range(len(x) - 1, -1, -1):
			y = ord(x[i]) - ord('0')
			num = pows[p] % mod
			num = num * y % mod
			num = num * freq[sz] % mod
			ans = (ans + num) % mod
			if it < sz:
				p += 2
			else:
				p += 1
			it += 1
print(ans)


import sys
import math
from math import *
import builtins
import collections
input = sys.stdin.readline

def print(x, end='\n'):
	sys.stdout.write(str(x) + end)

def get_int():
	return int(input())

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

def get_char_list():
	s = input()
	return list(s[:len(s) - 1])

def get_tuple_ints():
	return tuple(map(int, input().split()))

def print_iterable(p):
	print(' '.join(map(str, p)))

def CountFrequency(arr):
	return collections.Counter(arr)

def reverse(s):
	l = len(s)
	for i in range(l // 2):
		(s[i], s[l - i - 1]) = (s[l - i - 1], s[i])
	return s

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return high

def pow(a, n):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return pow(a, n // 2) % const * (pow(a, n // 2) % const) % const
	else:
		return pow(a, n // 2) % const * (pow(a, n // 2) % const) * (a % const) % const
global const
const = 998244353

def funop(n):
	if n == 0:
		return 0
	else:
		count = 0
		ans = 0
		while n > 0:
			ans += (10 ** (count + 1) * (n % 10) + 10 ** count * (n % 10)) % const
			n = n // 10
			count += 2
		return ans

def main():
	n = get_int()
	list = get_list_ints()
	ans = 0
	for i in range(n):
		ans += funop(list[i])
	ans = ans % const
	print(ans * n % const)
	pass
main()


M = 998244353
n = int(input())
a = [int(x) for x in input().split()]
from math import log
ans = 0

def op(n):
	out = 0
	if n == 0:
		return 0
	d = int(log(n, 10)) + 1
	for i in range(d + 1):
		out += 11 * 10 ** (2 * i) * (n % 10) % M
		n //= 10
	return out
for ai in a:
	ans += n * op(ai) % M
	ans %= M
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = []
sum1 = 0
for i in range(n):
	t = a[i]
	s = ' '
	c = []
	while t > 0:
		x = t % 10
		c.append(x)
		c.append(x)
		t = t // 10
	ans = 0
	c.reverse()
	for j in c:
		ans = ans * 10 + j
	sum1 += ans
sum1 = sum1 * n
sum1 %= 998244353
print(sum1)


n = int(input())
a = list(map(list, input().split()))
a = list(zip(*a))
a = [sum([int(j) for j in i]) for i in a]
a = [11 * i for i in a]
s = 0
M = 998244353
for i in a:
	s = s * 100 + i
	s = s % M
s *= n
s %= M
print(s)


MOD = 998244353
n = int(input())
a = list(map(int, input().split()))

def getDigits(num):
	res = []
	while num:
		res.append(num % 10)
		num //= 10
	return res
a = list(map(getDigits, a))
ret = 0
for digits in a:
	p = 0
	for (i, d) in enumerate(digits):
		ret += (10 ** p * d + 10 ** (p + 1) * d) * n
		ret %= MOD
		p += 2
print(ret)


def le2(num):
	s = str(num)
	ans = ''
	for i in s:
		ans += i + '0'
	ans = ans[:-1]
	return int(ans)

def m1(num, less):
	sn = str(num)
	sr = ''
	for i in range(less):
		sr += '0' + sn[-1]
		sn = sn[:-1]
	sr = sn + sr[::-1]
	return int(sr)

def m2(num, less):
	sn = str(num)
	sr = ''
	for i in range(less):
		sr += sn[-1] + '0'
		sn = sn[:-1]
	sr = sn + sr[::-1]
	return int(sr)
mod = 998244353
ans = 0
n = int(input())
d = [[] for i in range(11)]
a = list(map(int, input().split()))
for i in a:
	d[len(str(i))].append(i)
prev = 0
for i in range(1, 11):
	curlen = len(d[i])
	for lessnum in d[i - 1]:
		prev = (prev + le2(lessnum)) % mod
	ans = (ans + prev * curlen) % mod
	for lessdigits in range(1, i):
		downsum = 0
		for curnum in d[i]:
			downsum = (downsum + m1(curnum, lessdigits)) % mod
		ans = ans + downsum * len(d[lessdigits])
	cursuml1 = 0
	for enum in d[i]:
		res = le2(enum)
		ans = (ans + curlen * 11 * res) % mod
		cursuml1 = (cursuml1 + 10 * res) % mod
	for moredigits in range(i + 1, 11):
		ans = (ans + cursuml1 * len(d[moredigits])) % mod
		moresum = 0
		for morenum in d[moredigits]:
			moresum = (moresum + m2(morenum, i)) % mod
		ans = (ans + moresum * curlen) % mod
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
x = 0
for i in range(len(str(a[0]))):
	s = 0
	for j in range(n):
		s += a[j] % 10
		a[j] //= 10
	x += s * 11 * n * 10 ** (2 * i)
print(x % 998244353)


n = int(input())
t = list(map(int, input().split()))
u = [0] * 10
temp = t[0]
len = 0
while temp > 0:
	len += 1
	temp //= 10
for i in range(n):
	j = 9
	while t[i] > 0:
		u[j] += t[i] % 10
		t[i] = t[i] // 10
		j -= 1
ans = [0] * 30
for i in range(10 - len, 10):
	ans[i * 2] = u[i] * n % 998244353
	ans[i * 2 + 1] = u[i] * n % 998244353
ans2 = 0
for i in range((10 - len) * 2, 20):
	ans2 *= 10
	ans2 += ans[i]
print(ans2 % 998244353)


n = int(input())
sum = 0
line = input().split()
freq = []
for i in range(0, 11):
	freq.append(0)
for item in line:
	freq[len(item)] += 1

def solve1(str, l):
	n = len(str)
	i = 0
	s = ''
	if n >= l:
		s = str[0:n - l]
		i = n - l
	for k in range(i, n):
		s = s + str[k] + '0'
	return s

def solve2(str, l):
	n = len(str)
	i = 0
	s = ''
	if n >= l:
		s = str[0:n - l]
		i = n - l
	for k in range(i, n):
		s = s + '0' + str[k]
	return s
for i in range(0, n):
	for l in range(1, 11):
		if freq[l] != 0:
			temp1 = solve1(line[i], l)
			temp2 = solve2(line[i], l)
			sum = sum + (int(temp1) + int(temp2)) * freq[l]
			sum %= 998244353
print(sum)


nm = int(input())
ln = [int(i) for i in input().split(' ')]
sm = 0
for i in range(0, len(ln)):
	n = list(str(ln[i]))[::-1]
	for j in range(0, len(n)):
		sm = (sm + int(n[j]) * 10 ** (j * 2) * nm) % 998244353
		sm = (sm + int(n[j]) * 10 ** (j * 2 + 1) * nm) % 998244353
print(sm)


n = int(input())
kq = 0
MOD = 998244353
st = input().split()
for s in st:
	x = 0
	for si in s:
		x = x * 10 + int(si)
		x = x * 10 + int(si)
	kq = (kq + x) % MOD
kq = kq * n % MOD
print(kq)


n = int(input())
a = list(input().split())
total = 0
for i in range(0, n):
	for j in range(2 * len(a[0]) - 1, -1, -1):
		total += int(a[i][j // 2]) * n * 10 ** (2 * len(a[0]) - 1 - j)
print(total % 998244353)


import functools
n = int(input())
arr = input().split()
l = len(arr[0]) - 1
res = []
s = remainder = temp = 0
while l >= 0:
	s = 0
	for i in range(n):
		s += int(arr[i][l]) * n
	temp = s
	cnt = 2
	while cnt != 0:
		if cnt == 2:
			s += remainder
			res.append(s % 10)
			remainder = s // 10
		else:
			temp += remainder
			res.append(temp % 10)
			remainder = temp // 10
		cnt -= 1
	l -= 1
res.append(remainder)
res.reverse()
a = functools.reduce(lambda total, d: 10 * total + d, res, 0)
print(a % 998244353)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
n = int(input())
import heapq
ans = 0
m = 998244353
arr = list(map(int, input().split()))
for i in range(n):
	var = ''
	c = str(arr[i])
	for i in c:
		var += str(i) * 2
	var = int(var)
	ans += n * var % 998244353
print(ans % 998244353)


from sys import *
from math import *
mod = 998244353
n = int(stdin.readline())
a = list(input().split())
b = []
for i in range(n):
	s = list(map(int, a[i]))
	x = 0
	for j in s:
		x *= 10
		x += j
		x %= mod
		x *= 10
		x += j
		x %= mod
	b.append(x)
ans = sum(b) * n % mod
print(ans)


def f(s1, s2):
	p = len(s1)
	q = len(s2)
	if p == q:
		s = ''
		for i in range(p):
			s += s1[i]
			s += s2[i]
		return s
	if p > q:
		return s1[:p - q] + f(s1[p - q:], s2)
	else:
		return s2[:q - p] + f(s1, s2[q - p:])
n = int(input())
A = list(map(str, input().split()))
ans = 0
for i in range(n):
	ans = (ans + int(f(A[i], A[i]))) % 998244353
print(n * ans % 998244353)


n = int(input())
s = [int(i) for i in input().split()]
ans = 0
for i in range(n):
	c = 0
	while s[i] != 0:
		d = s[i] % 10
		s[i] //= 10
		ans += d * 11 * 10 ** c * n
		c += 2
		ans %= 998244353
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
A = list(input().split())
mod = 998244353

def calc(a, k):
	a0 = a[-k:]
	a1 = a[:-k]
	A1 = 0
	if a1 != '':
		A1 = int(a1) * 10 ** (k * 2) * 2
	ANS = ''
	for k in a0:
		ANS += k * 2
	return A1 + int(ANS)
L = [len(a) for a in A]
from collections import Counter
C = Counter(L)
ANS = 0
for a in A:
	for k in range(1, 11):
		x = C[k]
		ANS = (ANS + calc(a, k) * x) % mod
print(ANS)


mod = 998244353
n = int(input())
print(sum(list(map(lambda x: int('0'.join(list(x))), input().split()))) * 11 * n % mod)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
n = int(input())
mod = 998244353
vals = [[int(i) for i in k] for k in input().split()]
length = [0 for s in range(10)]
for i in range(n):
	digits = len(vals[i])
	length[digits - 1] += 1
ans = 0
for i in range(n):
	digits = len(vals[i])
	for s in range(10):
		cv = 0
		count = 0
		if digits - 2 <= s:
			for b in range(digits - 1, -1, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 2
		else:
			count += vals[i][-1]
			cv += 2
			for b in range(digits - 2, digits - 3 - s, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 2
			cv -= 1
			for b in range(digits - 3 - s, -1, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 1
		ans += count * length[s] % mod
		ans = ans % mod
for i in range(n):
	digits = len(vals[i])
	for s in range(10):
		cv = 1
		count = 0
		if digits - 1 <= s:
			for b in range(digits - 1, -1, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 2
		else:
			for b in range(digits - 1, digits - 2 - s, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 2
			cv -= 1
			for b in range(digits - 2 - s, -1, -1):
				count += vals[i][b] * pow(10, cv, mod)
				count = count % mod
				cv += 1
		ans += count * length[s] % mod
		ans = ans % mod
print(ans)


n = int(input())
a = input().split()
b = {}
c = {}
for x in a:
	y = len(x)
	z = int(x)
	b[y] = b.get(y, 0) + 1
	c[z] = c.get(z, 0) + 1
M = 998244353
p = [1] * 30
for i in range(1, len(p)):
	p[i] = p[i - 1] * 10 % M
ans = 0
for (key, val) in c.items():
	w = 0
	while key > 0:
		d = key % 10
		key //= 10
		z = 0
		for (x, y) in b.items():
			z += y * (p[min(w, x)] + p[min(w + 1, x)])
		ans += val * d * p[w] * z % M
		w += 1
print(ans % M)


modulo = 998244353
from collections import Counter

def conv(x):
	res = 0
	for v in x:
		res = (res * 100 + int(v)) % modulo
	return res
n = int(input())
x = list(input().split())
c = Counter((len(v) for v in x))
res = 0
for v in x:
	u = len(v)
	for (w, k) in c.items():
		if w >= u:
			res += k * 11 * conv(v)
		else:
			d = u - w
			res += k * 11 * conv(v[d:])
			res += k * 2 * int(v[:d]) * 10 ** (2 * w)
	res %= modulo
print(res)


n = int(input())
l = list(map(int, input().split()))
ans = 0
for elem in l:
	nn = 0
	ln = len(str(elem))
	for i in range(ln):
		nn += elem // 10 ** (ln - i - 1) % 10 * 11 * 10 ** ((ln - i - 1) * 2)
	ans += nn * n
print(ans % 998244353)


n = int(input())
l = list(map(list, input().split()))
d = len(l[0])
s = 0
for i in range(d):
	s += sum([int(l[j][-1 - i]) for j in range(n)]) * 10 ** (2 * i)
res = s * 11 * n % 998244353
print(res)


n = int(input())
L = list(map(int, input().split()))
sum = 0
for k in L:
	count = 0
	while k != 0:
		x = k % 10
		k = k // 10
		sum += n * x * 11 * 10 ** (count * 2)
		count += 1
print(sum % 998244353)


import sys
input = sys.stdin.readline
from collections import defaultdict

def f(a, b):
	(p, q) = (len(a), len(b))
	res = []
	if p >= q:
		res.append(a[:p - q + 1])
		for i in range(q - 1):
			res.append(b[i])
			res.append(a[p - q + 1 + i])
		res.append(b[q - 1])
	else:
		for i in range(q - p):
			res.append(b[i])
		for i in range(p):
			res.append(a[i])
			res.append(b[q - p + i])
	return int(''.join(res))
n = int(input())
a = list(input().split())
MOD = 998244353
d = defaultdict(int)
for ai in a:
	d[len(ai)] += 1
ans = 0
for ai in a:
	for i in range(1, 11):
		b = '0' * i
		ans += (f(ai, b) + f(b, ai)) * d[i] % MOD
		ans %= MOD
print(ans)


N = int(input())
A = list(map(int, input().split()))
mod = 998244353
L = len(str(A[0]))
ans = 0
for l in range(L):
	n = 0
	for a in A:
		n += int(str(a)[L - 1 - l])
	b = (10 ** (2 * l) + 10 ** (2 * l + 1)) % mod
	ans = (ans + n * b) % mod
ans = ans * N % mod
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
ans = int(0)
m = 998244353
for i in range(n):
	d = str(a[i])
	s = ''
	t = ''
	x = len(d)
	for j in range(x):
		t += '0'
		t += d[j]
	for j in range(x):
		s += d[j]
		s += '0'
	ans = (ans + int(t) * n + int(s) * n) % m
print(ans)


input()
(*a,) = map(int, input().split())
(counter, ans) = ([0] * 10, 0)
for i in a:
	counter[len(str(i)) - 1] += 1
for i in a:
	for (n, k) in enumerate(counter):
		ans += i * 10 * k
		d = 10 * 100 ** n
		i = i % d + (i - i % d) * 10
		ans += i * k
print(ans % 998244353)


n = int(input())

def cal(X):
	ans = 0
	_len = len(X)
	for i in range(_len):
		ans += int(X[i]) * 100 ** (_len - 1 - i)
	return ans * 11
A = input().split()

def LOL(n):
	if n == '':
		return 0
	else:
		return int(n)
cnt = [0 for i in range(11)]
for i in A:
	cnt[len(i)] += 1
ans = 0
for i in A:
	_len = len(i)
	for j in range(1, 1 + _len):
		ans += cnt[j] * (2 * LOL(i[:_len - j]) * 100 ** j + cal(i[_len - j:]))
	for j in range(_len + 1, 11):
		ans += cal(i) * cnt[j]
print(ans % 998244353)


from sys import stdin, stdout
mod = 998244353
s = stdin.readline()
n = int(s)
s = stdin.readline()
a = list(map(int, s.split()))
sum = 0
for i in a:
	copy = i
	cur = 0
	while copy > 0:
		digit = copy % 10
		copy //= 10
		digit *= n
		sum += digit * pow(10, cur)
		cur += 1
		sum += digit * pow(10, cur)
		cur += 1
print(sum % mod)


from sys import stdin, stdout
N = int(input())
arr1 = [int(x) for x in stdin.readline().split()]
arr2 = list(arr1)
L = 0
for i in range(N):
	L = max(L, len(str(arr1[i])))
res = 0
for i in range(1, L + 1):
	s = 0
	valid = 0
	remove = 0
	for j in range(N):
		num = arr1[j]
		if len(str(num)) >= i:
			valid += 1
		if len(str(num)) == i - 1:
			remove += 1
	for j in range(N):
		num = arr1[j]
		if len(str(num)) >= i:
			digit = int(str(num)[-i])
			A = 10
			B = 1
			s += valid * digit * 11
	for j in range(N):
		num = arr2[j]
		res += 10 ** (2 * i - 2) * 2 * num * remove
		arr2[j] = arr2[j] // 10
	res += 10 ** (2 * i - 2) * s
print(res % 998244353)


mod = 998244353

def solve(todo):
	ret = 0
	cnt = 0
	while todo > 0:
		fir = sec = todo % 10
		todo = todo // 10
		tmp = (fir << 1) + (fir << 3) + sec
		ret = tmp * 100 ** cnt + ret
		cnt += 1
	return ret
tmp = input()
n = int(tmp)
arr = [int(x) for x in input().split(' ')]
ans = 0
for x in arr:
	ans = ans + solve(x) * n
ans %= mod
print(ans)


M = 998244353
R = lambda : map(int, input().split())
n = int(input())
L = []
l = 0
for i in input().split():
	t = []
	l = len(i)
	for j in i:
		t.append(int(j))
	L.append(t)
for i in range(l):
	for j in range(1, n):
		L[j][i] += L[j - 1][i]
ans = 0
r = 0
s = 0
p = 1
for i in reversed(range(l)):
	if i == 0:
		for j in range(2):
			s = n * L[n - 1][i] + r
			if j == 1:
				ans += s * p
				ans %= M
			else:
				r = s // 10
				ans += s % 10 * p
				ans %= M
			p *= 10
		continue
	for j in range(2):
		s = n * L[n - 1][i] + r
		r = s // 10
		ans += s % 10 * p
		ans %= M
		p *= 10
print(ans)


n = int(input())
ls = list(map(int, input().split()))
ln = len(str(ls[0]))
ans = 0
for a in ls:
	for i in range(ln):
		ans += n * (a % 10 * (10 ** (2 * i + 1) + 10 ** (2 * i)))
		a = int((a - a % 10) / 10)
ans = ans % 998244353
print(int(ans))


r = 0
n = int(input()) * 11
for a in input().split():
	m = n
	a = int(a)
	while a != 0:
		r += m * (a % 10)
		a //= 10
		m *= 100
print(r % 998244353)


import sys
sys.setrecursionlimit(10 ** 5 + 10)

def input():
	return sys.stdin.readline().strip()

def resolve():
	MOD = 998244353
	n = int(input())
	A = list(map(str, input().split()))
	m = len(A[0])
	ans = 0
	for ni in range(n):
		for mi in range(m):
			weight = (m - mi - 1) * 2
			beki = 10 ** weight
			temp = beki * int(A[ni][mi]) * n
			temp %= MOD
			ans += temp
			ans %= MOD
			temp = beki * 10 * int(A[ni][mi]) * n
			temp %= MOD
			ans += temp
			ans %= MOD
	print(ans % MOD)
resolve()


def f(ch):
	return ord(ch) - ord('0')
n = int(input())
v = list(map(int, input().split()))
fr = [0] * 20
for x in v:
	fr[len(str(x))] += 1
for i in range(1, 20):
	fr[i] += fr[i - 1]
ans = 0
pre = [[-1] * 20 for _ in range(20)]
for x in v:
	strx = str(x)[::-1]
	for i in range(len(strx)):
		ans += 10 ** (2 * i + 1) * (n - fr[i]) * f(strx[i])
		dig = f(strx[i])
		if pre[i][dig] == -1:
			pre[i][dig] = 0
			for j in range(1, i + 1):
				pre[i][dig] += 10 ** (i + j) * (fr[j] - fr[j - 1]) * f(strx[i])
		ans += pre[i][dig]
pre = [[-1] * 20 for _ in range(20)]
for y in v:
	stry = str(y)[::-1]
	for i in range(len(stry)):
		ans += 10 ** (2 * i) * (n - (fr[i - 1] if i > 0 else 0)) * f(stry[i])
		dig = f(stry[i])
		if pre[i][dig] == -1:
			pre[i][dig] = 0
			for j in range(1, i):
				pre[i][dig] += 10 ** (i + j) * (fr[j] - fr[j - 1]) * f(stry[i])
		ans += pre[i][dig]
print(ans % 998244353)


n = int(input())
l = list(map(int, input().split(' ')))
s = 0
for a in l:
	p = 1
	while a > 0:
		d = a % 10
		s = s + 11 * p * d % 998244353
		s = s % 998244353
		p *= 100
		a //= 10
print(s * n % 998244353)


n = int(input())
a = list(map(int, input().split()))
M = 998244353
ans = 0
for i in range(n):
	j = 0
	while a[i] > 0:
		r = a[i] % 10
		ans = (ans % M + int(r * pow(10, j, M)) % M) % M
		j += 1
		ans = (ans % M + int(r * pow(10, j, M)) % M) % M
		a[i] //= 10
		j += 1
ans = ans * n % M
print(ans)


n = int(input())
a = list(input().split())
ans = 0
val = ''
for i in range(n):
	for alp in a[i]:
		val += alp * 2
	ans += n * int(val)
	val = ''
print(ans % 998244353)


from collections import defaultdict
m = 998244353
n = int(input())
a = list(input().split())
digits = defaultdict(int)
l = len(a[0]) * 2
for x in a:
	for (i, c) in enumerate(x):
		digits[l - i * 2] += int(c) * n
		digits[l - i * 2 - 1] += int(c) * n
for x in range(1, l + 1):
	current = digits[x]
	over = current // 10
	digits[x + 1] += over
	digits[x] %= 10
out = 0
mu = 1
for k in sorted(digits.keys()):
	out += digits[k] * mu
	out %= m
	mu *= 10
print(out)


n = int(input())
ans = 0
mod = 998244353
num = []
line = input()
for x in line.split():
	num.append(int(x))
for i in range(0, n):
	k = 1
	t = num[i]
	while int(t) > 0:
		ans = int(ans) + int(t % 10) * int(k) * int(n)
		ans = int(ans) % int(mod)
		ans = int(ans) + int(t % 10) * int(k) * int(n) * 10
		ans = int(ans) % int(mod)
		k = int(k * 100)
		t = int(t / 10)
ans = int(ans) % int(mod)
print(int(ans))


modulo = 998244353

def conv(x):
	res = 0
	for v in x:
		res = (res * 100 + int(v)) % modulo
	return res
n = int(input())
print(sum(map(conv, input().split())) * n * 11 % modulo)


from math import *
n = int(input())
mas = list(map(int, input().split()))
ans = 0
l = ''
v = ''
for i in range(n):
	l = str(mas[i])
	v = ''
	for j in range(len(l)):
		v = v + l[j] * 2
	ans = ans + int(v)
print(ans * n % 998244353)


n = int(input())
li = list(input().split(' '))
length = len(li[0])
result = 0
for i in range(n):
	for j in range(length):
		result = result + 10 ** (2 * j) * int(li[i][length - j - 1]) * n
		result = result + 10 ** (2 * j + 1) * int(li[i][length - j - 1]) * n
print(result % 998244353)


mod = 998244353
ten = [1]
for i in range(1, 30):
	ten.append(ten[i - 1] * 10 % mod)

def funcxy(bit, x_l, y_l):
	if x_l >= y_l:
		if y_l > bit:
			return ten[2 * bit + 1]
		else:
			return ten[bit + y_l]
	else:
		return ten[2 * bit + 1]

def funcyx(bit, x_l, y_l):
	if x_l > y_l:
		if y_l > bit:
			return ten[2 * bit]
		else:
			return ten[bit + y_l]
	else:
		return ten[2 * bit]
n = int(input())
a = [x for x in input().split()]
length = [len(x) for x in a]
d = {}
for x in length:
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
len_set = set(length)
res = 0
for x in a:
	x_l = len(x)
	x = [int(x_) for x_ in x[::-1]]
	for (i, xi) in enumerate(x):
		for y_l in len_set:
			res += xi * funcxy(i, x_l, y_l) * d[y_l]
			res += xi * funcyx(i, x_l, y_l) * d[y_l]
print(res % mod)


import math as mt
import sys, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
from collections import defaultdict
n = I()
l = L()
ans = 0
for i in l:
	w = ''
	for j in str(i):
		w += j * 2
	w = int(w)
	ans += w * n % 998244353
	ans %= 998244353
print(ans)


n = int(input())
l = list(map(int, input().split()))
x = len(str(l[0]))
s = 0
mod = 998244353
for i in range(n):
	strl = str(l[i])
	for li in range(x):
		power = 2 * (x - li) - 1
		s = (s + int(strl[li]) * 10 ** power * n) % mod
		power = 2 * (x - li - 1)
		s = (s + int(strl[li]) * 10 ** power * n) % mod
print(s)


mod = 998244353
n = int(input())
l = input().split()
k = len(l[0])
a = [None] * k
for i in range(k):
	s = 0
	for j in range(n):
		s += n * int(l[j][i])
	a[i] = s
ans = 0
mf = 1
for i in a[::-1]:
	ans = (ans + i * mf) % mod
	mf *= 10
	ans = (ans + i * mf) % mod
	mf *= 10
print(ans)


n = int(input())
h = list(map(int, input().split()))
a = h[0]
b = len(str(a))
s = 0
for k in h:
	d = 0
	i = b - 1
	while i > -1:
		d += int(str(k)[i]) * 10 ** (2 * (b - 1 - i)) * 11
		i -= 1
	d = d * n % 998244353
	s = (s + d) % 998244353
print(s)


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	N = 10001
	invfact = [0] * N
	fact = [1] * N
	for i in range(1, N):
		fact[i] = fact[i - 1] * i % mod
	invfact[-1] = pow(fact[-1], mod - 2, mod)
	for i in range(N - 2, -1, -1):
		invfact[i] = (i + 1) * invfact[i + 1] % mod

	def nCr(x, y):
		if y > x:
			return 0
		ans = invfact[x - y] * invfact[y] % mod
		ans *= fact[x]
		ans %= mod
		return ans
	n = ii()
	a = list(map(str, input().split()))
	count = [0] * 21
	elem_size = [0] * 11
	for i in a:
		elem_size[len(i)] += 1
	for i in range(n):
		n1 = len(a[i])
		cur = list(a[i])
		for j in range(1, n1):
			idx = 0
			x = n1 - j
			k = 2 * j + x - 1
			while x:
				count[k] += 2 * elem_size[j] * int(cur[idx]) % mod
				count[k] %= mod
				x -= 1
				k -= 1
				idx += 1
			f = 0
			for k1 in range(k, -1, -1):
				count[k1] += elem_size[j] * int(cur[idx]) % mod
				count[k1] %= mod
				if f:
					idx += 1
				f ^= 1
		for j in range(n1, 11):
			idx = 0
			f = 0
			for k in range(2 * n1 - 1, -1, -1):
				count[k] += elem_size[j] * int(cur[idx]) % mod
				count[k] %= mod
				if f:
					idx += 1
				f ^= 1
	ans = 0
	pw = 1
	for i in range(21):
		ans += count[i] * pw % mod
		ans %= mod
		pw *= 10
		pw %= mod
	print(ans)
if file:
	if path.exists('tmp/input.txt'):
		sys.stdin = open('tmp/input.txt', 'r')
		sys.stdout = open('tmp/output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


query = int(input())
nos = input().split()
s = 0
for sin in nos:
	for i in range(len(sin)):
		s += query * 100 ** i * 11 * int(sin[len(sin) - 1 - i])
print(s % 998244353)


n = int(input())
a = list(input().split())
digit = len(a[0])
ans = 0
for j in range(digit):
	anstemp = 0
	for i in range(n):
		anstemp += int(a[i][-j - 1])
	ans += anstemp * 10 ** (2 * j) * n
	ans %= 998244353
	ans += anstemp * 10 ** (2 * j + 1) * n
	ans %= 998244353
print(ans)


def func(s1, s2):
	s = ''
	for i in range(len(s1)):
		s += s1[i]
		s += s2[i]
	return int(s)
n = int(input())
x = input().split()
x.sort()
ans = 0
l = [0] * len(x[0])
for i in x:
	for j in range(len(x[0])):
		l[j] += int(i[j])
for i in range(len(l)):
	l[i] = n * l[i]
l = l[::-1]
ans = ''
carry = 0
for i in range(len(l)):
	c = str((l[i] + carry) % 10)
	ans += c
	carry = (l[i] + carry) // 10
	c = str((l[i] + carry) % 10)
	ans += c
	carry = (l[i] + carry) // 10
ans += str(carry)[::-1]
print(int(ans[::-1]) % 998244353)


n = int(input())
s = input().split(' ')
ans = 0
MOD = 998244353
for t in s:
	a = ''
	for c in t:
		a += c
		a += c
	ans += n * int(a)
	ans %= MOD
print(ans)


import math as M
mod = 998244353

def f(a, b):
	x = ''
	s = str(a)
	for ele in s:
		x = x + ele
		x = x + '0'
	t = str(b)
	y = ''
	for ele in t:
		y = y + ele
		y = y + '0'
	y = int(y)
	y //= 10
	x = int(x)
	return x + y

def calculate(A, n):
	s = 0
	for i in range(n):
		s += f(A[i], A[i])
	return s * n
n = int(input())
A = list((int(i) for i in input().split()))
print(calculate(A, n) % mod)


n = int(input())
array = list(input().split(' '))
sum = 0
for i in range(n):
	count = len(array[0]) - 1
	for j in range(len(array[0]) * 2):
		sum += 10 ** j * int(array[i][count]) * n
		if j % 2 != 0:
			count -= 1
print(sum % 998244353)


n = int(input())
x = input()
x = [i for i in x.split()]
length = {}
for i in x:
	if len(i) not in length:
		length[len(i)] = 1
	else:
		length[len(i)] = length[len(i)] + 1
dict = {}
ans = 0
for i in range(n):
	l = ''
	r = ''
	for j in range(1, 11):
		num = x[i]
		extra = ''
		if len(num) > j:
			extra = num[0:len(num) - j]
		if len(num) - j >= 0:
			l = '0' + num[len(num) - j] + l
			r = num[len(num) - j] + '0' + r
		le = extra + l
		re = extra + r
		if j in length:
			ans += int(le) * length[j]
			ans += int(re) * length[j]
print(ans % 998244353)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))))

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
n = val()
l = li()
tot = 0
for i in l:
	curr = 0
	for j in str(i)[::-1]:
		tot = (tot + n * int(j) * pow(10, curr)) % mod
		tot = (tot + n * int(j) * pow(10, curr + 1)) % mod
		curr += 2
print(tot)
1122
1323
1425
3333
3132
3435
4455
4152
4353


INF = 10 ** 10
MOD = 998244353

def mod_mul(x, y, z=0):
	result = 0
	if y == 0:
		return result
	while y > 1:
		if y & 1 == 1:
			result += x
			if result >= MOD:
				result -= MOD
		x += x
		if x >= MOD:
			x -= MOD
		y >>= 1
	result += x
	if result >= MOD:
		result -= MOD
	result += z
	if result >= MOD:
		result -= MOD
	return result

def main():
	n = int(input())
	str_a = input().split()
	counter = [0] * 11
	for ai in str_a:
		counter[len(ai)] += 1
	pow10 = [0] * 19
	pow10[0] = 1
	for i in range(18):
		pow10[i + 1] = mod_mul(pow10[i], 10)
	ans = 0
	for i in range(n):
		for (j, digit) in enumerate(reversed(str_a[i])):
			digit = ord(digit) - 48
			for k in range(1, 11):
				ans = mod_mul(mod_mul(counter[k] * digit, pow10[min(2 * j, j + k)]), 11 if j < k else 2, ans)
	print(ans % MOD)
import sys
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()
print(*out, sep='\n')


def add(a, b):
	return (a + b) % 998244353
n = int(input())
a = [int(x) for x in input().split()]
pows = [10 ** x for x in range(30)]
digits = [0 for i in range(11)]
for num in a:
	digits[len(str(num))] += 1
res = 0
for num in a:
	d = [int(dig) for dig in str(num)]
	p = len(str(num))
	for q in range(1, 11):
		curr = 0
		if p >= q:
			for i in range(p - q + 1):
				curr = add(curr, d[i] * pows[p + q - i - 1])
			for i in range(p - q + 1, p):
				curr = add(curr, d[i] * pows[2 * q - 3 - 2 * (i - (p - q + 1))])
		else:
			for i in range(p):
				curr = add(curr, d[i] * pows[2 * (p - i) - 1])
		curr *= digits[q]
		res = add(res, curr)
		curr = 0
		if q >= p:
			for i in range(p):
				curr = add(curr, d[i] * pows[2 * (p - 1 - i)])
		else:
			for i in range(p - q):
				curr = add(curr, d[i] * pows[p + q - 1 - i])
			for i in range(q):
				curr = add(curr, d[i + p - q] * pows[2 * (q - 1 - i)])
		curr *= digits[q]
		res = add(res, curr)
print(res)


n = int(input())
col = 0
m = 998244353
a = [int(el) for el in input().split()]
for i in range(n):
	s = str(a[i])
	x = len(s)
	res = ''
	for j in range(x):
		res += s[j]
		res += '0'
	con = 0
	for j in range(x * 2):
		con += int(res[j])
		con *= 10
	col += n * (con // 10) + n * (con // 100)
print(col % m)


n = int(input())
arr = list(map(int, input().split()))
ans = ''
a = 0
carryover = 0
for k in range(1, len(str(arr[0])) + 1):
	a = 0
	for i in arr:
		a += n * int(str(i)[-k])
	if k == len(str(arr[0])):
		ans = str(a + carryover)[-1] + ans
		if len(str(a + carryover)) > 1:
			carryover = int(str(a + carryover)[:-1])
		else:
			carryover = 0
		ans = str(a + carryover) + ans
	else:
		ans = str(a + carryover)[-1] + ans
		if len(str(a + carryover)) > 1:
			carryover = int(str(a + carryover)[:-1])
		else:
			carryover = 0
		a = a + carryover
		ans = str(a)[-1] + ans
		if len(str(a)) > 1:
			carryover = int(str(a)[:-1])
		else:
			carryover = 0
print(int(ans) % 998244353)


from sys import stdin
n = int(stdin.readline())
a = list(stdin.readline().split())
d = dict()
for x in range(13):
	d[x] = 0
for x in a:
	d[len(x)] += 1
ans = 0
MOD = 998244353
for x in a:
	for y in d:
		if d[y]:
			str1 = ''
			str2 = ''
			temp = x[::-1]
			z = 0
			while z < min(len(x), y):
				str1 += temp[z]
				str1 += '0'
				str2 += '0'
				str2 += temp[z]
				z += 1
			while z < len(x):
				str1 += temp[z]
				str2 += temp[z]
				z += 1
			ans += (int(str1[::-1]) + int(str2[::-1])) * d[y] % MOD
print(ans % MOD)


n = int(input())
A = input().split()
_len = len(A[0])
prec = [0 for i in range(_len)]
for i in range(_len):
	for j in A:
		prec[i] += int(j[i])
ans = 0
for i in range(_len):
	ans += prec[i] * 11 * n * 10 ** (2 * (_len - 1 - i))
print(ans % 998244353)


def b(k):
	s = str(k)
	ans = ''
	for i in s:
		ans += i + '0'
	ans = ans[:-1]
	return int(ans)
n = int(input())
a = list(map(int, input().split()))
mod = 998244353
ans = 0
for i in range(n):
	ans = (ans + n * 11 * b(a[i])) % mod
print(ans)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	s = []
	for j in range(len(str(a[i]))):
		s.append(str(a[i])[j])
		s.append(str(a[i])[j])
	a[i] = int(''.join(s))
print(n * sum(a) % 998244353)


from collections import Counter
n = int(input())
arr = [str(i) for i in input().split()]
p = 998244353
freq = [0 for i in range(10)]
for i in range(n):
	ll = len(arr[i])
	for j in range(ll):
		freq[ll - 1 - j] += int(arr[i][j])
		freq[ll - 1 - j] = freq[ll - 1 - j] % p
ans = 0
for i in range(10):
	x = freq[i] * pow(10, 2 * i, p)
	ans += x % p
	ans = ans % p
ans = ans * n % p
ans = ans * 11 % p
print(ans)


def c(a):
	s = ''
	for i in range(len(a)):
		s = s + a[i] * 2
	return int(s)
n = int(input())
ar = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans = (ans + n * c(str(ar[i])) % 998244353) % 998244353
print(ans)


n = int(input())
ans = 0
mod = 998244353
li = input().split()
for i in li:
	t = 10
	for j in i[::-1]:
		ans += (ord(j) - ord('0')) * t * n
		ans += (ord(j) - ord('0')) * (t // 10) * n
		t *= 100
	ans %= mod
print(ans)


n = int(input())
a = [[int(j) for j in i] for i in input().split()]
module = 998244353
length_of_num = len(a[0])
total_sum = 0
pos = 0
rank = length_of_num * 2 - 1
while pos != length_of_num:
	sum_of_digits = 0
	for num in a:
		sum_of_digits += num[pos]
	total_sum = (total_sum + n * sum_of_digits * 10 ** rank) % module
	rank -= 1
	total_sum = (total_sum + n * sum_of_digits * 10 ** rank) % module
	rank -= 1
	pos += 1
print(total_sum)


import sys

def fun1(x):
	d = 10
	op = 0
	while x > 0:
		op = op + x % 10 * d
		d = d * 100
		x = x // 10
		op = op % 998244353
	return op

def fun2(x):
	d = 1
	op = 0
	while x > 0:
		op = op + x % 10 * d
		d = d * 100
		x = x // 10
		op = op % 998244353
	return op
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().strip().split()))
a1 = list(map(fun1, a))
a2 = list(map(fun2, a))
op = 0
op = n * (sum(a2) % 998244353) % 998244353
op += n * (sum(a1) % 998244353) % 998244353
op = op % 998244353
print(op)


n = int(input())
a = input().split()
ans = 0
for i in range(n):
	t = a[i][::-1]
	tmp = ''
	for j in range(len(t)):
		tmp += t[j]
		tmp += t[j]
	for j in range(len(tmp)):
		ans += int(tmp[j]) * n * int(10 ** j)
ans %= 998244353
print(ans)


def f(a, step, mod):
	i = 1
	answer = 0
	while a > 9:
		c = a % 10
		a //= 10
		answer += (step[i] + step[i - 1]) * c % mod
		i += 2
	answer += (step[i] + step[i - 1]) * a % mod
	return answer

def main():
	answer = 0
	mod = 998244353
	n = int(input())
	step = []
	c = 1
	for i in range(20):
		step.append(c)
		c *= 10
	for c in list(map(int, input().split())):
		answer += f(c, step, mod) * n % mod
	answer %= mod
	print(answer)
main()


n = int(input())
line = input().split()
a = [list() for i in range(12)]
for num in line:
	a[len(num)].append(int(num))
res = 0
for (lenx, z) in enumerate(a):
	for x in z:
		place = 1
		left = n
		temp = x
		for (i, arr) in enumerate(a):
			f = len(arr)
			if f == 0:
				continue
			if i == lenx:
				break
			left -= f
			place = 1
			j = 0
			x = temp
			while j < i:
				digit = x % 10
				res += f * digit * place
				place *= 10
				res += f * digit * place
				x //= 10
				place *= 10
				j += 1
				res %= 998244353
			while x > 0:
				digit = x % 10
				res += f * 2 * digit * place
				x //= 10
				place *= 10
				res %= 998244353
		place = 1
		x = temp
		while x > 0:
			digit = x % 10
			res += left * digit * place
			place *= 10
			res += left * digit * place
			x //= 10
			place *= 10
			res %= 998244353
print(res % 998244353)


n = int(input())
numbers = input().split()
length = len(numbers[0])
x = 2 * 3 + 3 * 3 + 5 * 3
y = 1 * 3 + 3 * 3 + 4 * 3
number = 0
for i in range(length):
	number *= 10
	number += n * sum([int(numbers[j][i]) for j in range(n)]) * (10 ** (length - i) + 10 ** (length - i - 1))
	number %= 998244353
print(number)


n = int(input())
l = list(map(int, input().split()))
for i in l:
	i = i % 998244353
sd = 0
for i in l:
	j = ''
	for u in range(len(str(i))):
		j = j + str(i)[u] * 2
	sd = sd + int(j) % 998244353 * n
print(sd % 998244353)


def f(x, y):
	x = str(x)
	y = str(y)
	n = ''
	for i in range(1, len(x) + 1):
		n += y[len(x) - i]
		n += x[len(x) - i]
	n = n[::-1]
	return int(n)

def space(x):
	x = str(x)
	newstring = ''
	for i in x:
		newstring += i
		newstring += '0'
	return int(newstring[:-1])
a = input()
b = input()
a = int(a)
b = b.split()
c = []
for i in b:
	c.append(int(i))
summer = 0
for i in c:
	summer += space(i) * a
	summer += space(i) * a * 10
print(summer % 998244353)


from sys import stdin

def main():
	n = int(input())
	aa = input().split()
	aad = [[int(ad) for ad in a] for a in aa]
	aat = list(map(list, zip(*aad)))
	aas = list(map(sum, aat))
	res = 0
	for i in range(len(aa[0])):
		s = aas[i] * n
		res = (res * 10 + s) % 998244353
		res = (res * 10 + s) % 998244353
	print(res)
main()


mod = 998244353

def count(s):
	sum = 0
	c = 1
	for i in s[::-1]:
		sum += int(i) * c
		c *= 100
	return sum
n = int(input())
a = input().split()
ss = 0
for i in a:
	ss += count(i) % mod
print(11 * n * ss % mod)


mod = 998244353
s = 0
input()
d = [0] * 11

def get(n, l, i):
	if l < i:
		return (n, d[i] * 11 * (int(n) % mod) % mod)
	t = int(n) % mod * 10 % mod
	n = n[:-(2 * i - 1)] + '0' + n[-(2 * i - 1):]
	return (n, d[i] * (t + int(n) % mod) % mod % mod)
l = input().split()
for i in l:
	d[len(i)] += 1
for i in l:
	n = i
	x = len(n)
	for j in range(1, 11):
		(n, tmp) = get(n, x, j)
		s = (s + tmp) % mod
print(s)


from collections import Counter
_MODER = 998244353

def solve(n, a):
	r = 0
	c = Counter()
	for e in a:
		c[len(str(e))] += 1
	for e in a:
		s = str(e)
		current_len = len(s)
		for (k, v) in c.items():
			if k >= current_len:
				ns = '0'.join(list(s)) + '0'
			else:
				ns = s[:current_len - k] + '0'.join(list(s[current_len - k:])) + '0'
			r = (r + int(ns) * v % _MODER) % _MODER
			if k >= current_len - 1:
				ns = '0'.join(list(s))
			else:
				ns = s[:current_len - k - 1] + '0'.join(list(s[current_len - k - 1:]))
			r = (r + int(ns) * v % _MODER) % _MODER
	return r
n = int(input())
a = list(map(int, input().split()))
r = solve(n, a)
print(r)


ans = 0
n = int(input())
nums = [[] for i in range(n + 1)]
a = list(map(int, input().split()))
for i in range(n):
	while True:
		nums[i].append(a[i] % 10)
		a[i] //= 10
		if a[i] == 0:
			break
k = len(nums[0])
pows10 = [10 ** i for i in range(20)]
for i in range(n):
	for j in range(k, 0, -1):
		p = nums[i][j - 1]
		ans = (ans + n * p * pows10[2 * j - 1]) % 998244353
		ans = (ans + n * p * pows10[2 * j - 2]) % 998244353
print(ans)


def func(a, n):
	temp1 = 0
	temp2 = 0
	powe = 10
	while a > 0:
		k = a % 10
		temp1 += powe * k
		temp2 += powe // 10 * k
		a //= 10
		powe *= 100
	return (temp1 % 998244353 * (n % 998244353) % 998244353 + temp2 % 998244353 * (n % 998244353) % 998244353) % 998244353
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans += func(l[i], n)
	ans = ans % 998244353
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
z = 0
p = len(str(a[0])) * 2 - 1
for j in range(len(str(a[0]))):
	z1 = 0
	for i in range(n):
		k = str(a[i])
		z1 += int(k[j])
	z += (z1 * 10 ** p + z1 * 10 ** (p - 1)) % 998244353
	p -= 2
print(z * n % 998244353)


def dig(n):
	a = 0
	while n:
		n = n // 10
		a += 1
	return a

def twoD(n):
	s = str(n)
	ss = ''
	for i in s:
		ss = ss + 2 * i
	return int(ss)
n = int(input())
MOD = 998244353
arr = [int(x) for x in input().split()]
k = dig(arr[0])
count = 0
for i in arr:
	t = twoD(i)
	count += n * t
	count = count % MOD
print(count)


import sys
input = sys.stdin.readline

def fu(a):
	s = 0
	j = 0
	for i in str(a)[::-1]:
		s += int(i) * 10 ** j
		j += 2
	return s % mod
mod = 998244353
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
	s += fu(a[i]) * 11
	s = s % mod
print(s * n % mod)


n = int(input())
array = list(map(int, input().split(' ')))
count = [0 for i in range(10)]
for i in array:
	count[len(str(i)) - 1] += 1
result = 0
for i in array:
	for (l, c) in enumerate(count):
		result += i * 10 * c
		d = 10 * 100 ** l
		i = i % d + (i - i % d) * 10
		result += i * c
print(result % 998244353)


def modmul(a, b, m):
	return a % m * (b % m) % m

def modadd(a, b, m):
	return (a % m + b % m) % m
n = int(input())
a = [int(i) for i in input().split()]
m = 998244353
f = 1
ans = 0
while a[0] > 0:
	tmp = f
	for i in range(n):
		f = tmp
		for j in range(2):
			ans = modadd(modmul(modmul(a[i] % 10, n, m), f, m), ans, m)
			if j == 0:
				f *= 10
		a[i] = a[i] // 10
	f *= 10
print(ans)


n = int(input())
p = [0 for x in range(0, 20)]
q = str(input())
qq = q.split(' ')
for i in range(0, n):
	j = 1
	t = int(qq[i])
	while t != 0:
		p[j] += t % 10
		t //= 10
		j += 1
mod = 998244353
ans = 0
t = n
for i in range(1, 20):
	ans = (ans + p[i] * t) % mod
	t *= 10
	ans = (ans + p[i] * t) % mod
	t *= 10
print(ans)


n = int(input())
arr = list(map(int, input().split()))
s = 0
mod = 998244353
p = [10 ** i for i in range(20)]
l = len(str(arr[0]))
for i in range(n):
	num = arr[i]
	st = str(num)
	for j in range(len(st) - 1, -1, -1):
		d = int(st[j])
		s += (d * p[2 * (l - j - 1)] + d * p[2 * (l - j - 1) + 1]) * n
		s %= mod
print(s)


n = int(input())
ans = [0] * 30
length = [0] * 11
lol = [o for o in input().split()]
count = [0] * 30
for i in range(n):
	length[len(lol[i]) - 1] += 1
for i in range(n):
	lol[i] = lol[i][::-1]
	for j in range(len(lol[i])):
		for k in range(j):
			ans[2 * k + (j - k) + 1] += 2 * (int(lol[i][j]) * length[k])
		for k in range(j, 10):
			ans[2 * j] += int(lol[i][j]) * length[k]
			ans[2 * j + 1] += int(lol[i][j]) * length[k]
realans = ['0'] * 30
c = 0
for i in range(30):
	realans[i] = str(int(ans[i] + c) % 10)
	c = (ans[i] + c) // 10
print(int(''.join(realans[::-1])) % 998244353)


import collections
import math
n = int(input())
a = [x for x in input().split(' ')]
size = len(a[0])
current = 1
ans = 0
mod = 998244353
for j in reversed(range(size)):
	for i in range(n):
		ans += int(a[i][j]) * n * current
		ans = ans % mod
		ans += int(a[i][j]) * n * (current * 10)
		ans = ans % mod
	current = current * 100
print(ans % mod)


n = int(input())
x = str(input()).split()
l = len(x[0])
ans = 0
for i in range(l):
	p = l - i - 1
	for num in x:
		d = int(num[p])
		d *= n
		ans += 10 ** (2 * i) * d
		ans += 10 ** (2 * i + 1) * d
print(ans % 998244353)