#include typedef long long LL; const int N = 2e5 + 7; const int MOD = 998244353; int n, m; int main() { scanf("%d", &n); std::vector a(n); for(LL &v: a) scanf("%lld", &v); std::sort(a.begin(), a.end()); int x = 0; for(LL v: a) x = (10LL * x + v) % MOD; printf("%d\n", x); return 0; }