#include <bits/stdc++.h>
using namespace std;
long long modpow(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 998244353;
    y = y >> 1;
    x = (x * x) % 998244353;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long res = 0, si = 1 + log10(arr[0]), x = 1;
  long long mult = 11;
  for (int i = 0; i < si; i++) {
    long long s1 = 0;
    for (int j = 0; j < n; j++) {
      s1 = (s1 + arr[j] % 10) % 998244353;
      arr[j] /= 10;
    }
    s1 = (s1 * n) % 998244353;
    res = (res + (s1 * mult) % 998244353) % 998244353;
    mult = (mult * 100) % 998244353;
  }
  cout << res << endl;
  return 0;
}
