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