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