MOD = 998244353 N = int(input()) A = list(map(int, input().split())) A.sort() x = 0 for i in range(N): x = 10 * x + A[i] x %= MOD print(x)