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