#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) using ll = long long int; #define MOD 998244353 int main() { int N; cin >> N; vector A(N); rep(i, N) cin >> A[i]; sort(A.begin(), A.end()); int x = 0; rep(i, N) { x = (10* (ll)x + A[i]) % MOD; } cout << x << endl; return 0; }