import typing import sys from collections import defaultdict input = lambda: sys.stdin.readline().strip() inf = 10**18 mod = 998244353 # import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') # sys.setrecursionlimit(10**6) def solve(): N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 for x in A: ans = ans*10 + x ans %= mod print(ans) def main(): t = 1 for _ in range(t): solve() main()