#include <bits/stdc++.h>
using namespace std;
const long long maxv = 1e5 + 5;
const long long mod = 998244353;
long long n, a[maxv], ans, digit[10], sum[maxv][10], last[10];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(last, 0, sizeof(last));
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= 9; j++) {
      long long now = a[i], cnt = 10, co = 0;
      while (now) {
        co++;
        long long tmp1 = now % 10 % mod * cnt % mod;
        digit[j] = (digit[j] + tmp1) % mod;
        if (co < j) {
          cnt = cnt * 100 % mod;
        } else {
          cnt = cnt * 10 % mod;
        }
        now /= 10;
      }
      sum[i][j] = digit[j] - last[j];
      last[j] = digit[j];
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long now = a[i], cnt = 1, co = 0, aa = 0;
    while (now) {
      co++;
      long long tmp = now % 10 * cnt % mod;
      aa = (aa + tmp) % mod;
      cnt = cnt * 100 % mod;
      now /= 10;
    }
    aa = aa * n % mod;
    ans = (ans + digit[co]) % mod;
    ans = (ans + aa) % mod;
  }
  cout << ans << endl;
  return 0;
}
