#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f;
using namespace std;
const long long maxn = 2e5 + 100;
const long long mod = 998244353;
long long a[maxn];
long long getlen(long long x) {
  long long cnt = 0;
  while (x > 0) {
    cnt++;
    x /= 10;
  }
  return cnt;
}
long long dec1[30];
int32_t main() {
  long long n;
  scanf("%lld", &(n));
  dec1[0] = 1;
  dec1[1] = 1;
  for (long long i = 2; i <= 20; i++) dec1[i] = dec1[i - 1] * 10;
  for (long long i = (1); i <= (n); i++) scanf("%lld", &(a[i]));
  long long len = getlen(a[1]);
  long long ans = 0;
  for (long long i = (1); i <= (n); i++) {
    long long t = 0;
    for (long long j = (1); j <= (len); j++) {
      long long x = a[i] % 10;
      a[i] /= 10;
      t += x * dec1[j * 2 - 1];
      t %= mod;
    }
    ans = ans % mod + (n % mod) * ((t % mod) * (10 % mod)) % mod +
          (n % mod) * (t % mod);
    ans %= mod;
  }
  cout << ans;
  return 0;
}
