#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long powe(int b, int n) {
  long long prod = 1;
  while (n) {
    prod = ((prod % mod) * (10)) % mod;
    --n;
  }
  return prod;
}
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long len = 1;
  long long total = 0;
  while (arr[0]) {
    for (int i = 0; i < n; ++i) {
      long long b = arr[i] % 10;
      arr[i] = arr[i] / 10;
      long long cur = (powe(10, 2 * len - 1) * b * n) % mod;
      total = ((total % mod) + (cur % mod)) % mod;
      cur = (powe(10, 2 * len - 2) * b * n) % mod;
      total = ((total % mod) + (cur % mod)) % mod;
    }
    ++len;
  }
  cout << total % mod;
  return 0;
}
