#include <bits/stdc++.h>
using namespace std;
long long int MOD = 998244353;
long long int pp(long long int aa) {
  long long int cc = 1;
  while (aa--) cc *= 10;
  return cc;
}
int main() {
  int t = 1;
  while (t--) {
    long long int n, k;
    cin >> n;
    vector<long long int> ans;
    vector<long long int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    long long int jj = 1;
    while (a[0] > 0) {
      k = 0;
      for (int i = 0; i < n; i++) {
        k += (a[i] % 10);
        k %= MOD;
        a[i] /= 10;
      }
      k = (1LL * k * (jj % MOD)) % MOD;
      ans.push_back(k);
      k = k * 10;
      k %= MOD;
      ans.push_back(k);
      jj *= 100;
      jj %= MOD;
    }
    k = 0;
    for (int i = 0; i < ans.size(); i++) {
      k = k + (1LL * (ans[i] % MOD) * (n % MOD)) % MOD;
      k %= MOD;
    }
    cout << k;
  }
  return 0;
}
