#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int MOD = 998244353;
long long n, x, len, ans = 0;
long long freq[N][10], pows[N];
long long prod(long long a, long long b) { return (a * b) % MOD; }
long long add(long long a, long long b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  pows[0] = 1;
  for (int i = 1; i <= N; i++) {
    pows[i] = pows[i - 1] * 10;
    pows[i] %= MOD;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    len = 0;
    while (x != 0) {
      len++;
      freq[len][x % 10]++;
      x /= 10;
    }
  }
  for (int i = len; i >= 1; i--) {
    for (long long dig = 1; dig <= 9; dig++) {
      ans = add(ans, prod(prod(prod(dig, freq[i][dig]), pows[i * 2 - 1]), n));
      ans = add(ans, prod(prod(prod(dig, freq[i][dig]), pows[i * 2 - 2]), n));
    }
  }
  cout << ans << '\n';
  return 0;
}
