#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  const long long mod = 998244353;
  long long n, s = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, k = 11;
    cin >> x;
    while (x)
      s = (s + (k * (x % 10)) % mod) % mod, k = (k * 100) % mod, x /= 10;
  }
  long long k = s;
  for (long long i = 1; i < n; i++) s = (s + k) % mod;
  cout << s;
  return 0;
}
