N,*V=map(int,open(0).read().split());V=sorted(V);cnt=0 for i in range(N):cnt=((cnt*10)+V[i])%998244353 print(cnt)