#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6, MOD = 998244353;
long long a[N], st[N];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long k = a[0], kol = 0;
  while (k > 0) {
    k /= 10;
    kol++;
  }
  st[0] = 1;
  for (long long i = 1; i <= kol + kol; i++) {
    st[i] = st[i - 1] * 10ll;
    st[i] %= MOD;
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    long long k = a[i], kol1 = 0;
    while (k > 0) {
      long long o = k % 10ll;
      k /= 10;
      sum += ((st[kol1] * o) % MOD * n) % MOD;
      sum %= MOD;
      sum += ((st[kol1 + 1] * o) % MOD * n) % MOD;
      sum %= MOD;
      kol1 += 2;
    }
  }
  cout << sum;
  return 0;
}
