#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
long long a[N], d = 1;
long long rev(long long x) {
  long long n = 0;
  while (x) {
    n = n * 10 + x % 10;
    x /= 10;
  }
  return n;
}
long long expand(long long x) {
  long long n = x % 10;
  for (int i = 1; i < d; i++) {
    x /= 10;
    n = n * 100 + x % 10;
  }
  return n;
}
int main() {
  long long t, x;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a[i];
  }
  x = 10;
  while (a[0] >= x) {
    x *= 10;
    d++;
  }
  x = 998244353;
  long long ans = 0;
  for (int i = 0; i < t; i++) {
    ans += (expand(rev(a[i])) % x) * t;
    ans += (((expand(rev(a[i])) % x) * 10) % x) * t;
    ans = ans % x;
  }
  cout << ans << endl;
  return 0;
}
