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