#include using namespace std; const int INF = 1<<30; const int MOD = 998244353; //const long long INF = 1LL<<60; using graph = vector>; using ll = long long; int main(){ int n; cin >> n; vector a(n); for (int i=0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); ll ans = 0; for (int i=0; i < n; i++){ ans = ans * 10 + a[i]; ans %= MOD; } cout << ans << endl; }