#include <bits/stdc++.h>
using namespace std;
long long f(long long a, long long b, int l) {
  long long res = 0;
  int k = 0;
  while (k != l) {
    k++;
    long long t = powl(10, l - k);
    res = (res % 998244353) * 10;
    res += a / t;
    a = a % t;
    res = (res % 998244353) * 10;
    res += b / t;
    b = b % t;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int l = 0;
  long long t;
  t = v[0];
  while (t != 0) {
    l++;
    t /= 10;
  }
  long long s = 0;
  for (int i = 0; i < n; i++) s += f(v[i], v[i], l);
  s = ((s % 998244353) * n) % 998244353;
  cout << s;
}
