#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, NegOO = -1 * OO, N = 1e5 + 5, mod = 998244353;
unsigned long long n, len, mypow;
string arr[N];
long long Pow(long long base, long long exponent) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % mod;
    exponent = exponent >> 1;
    base = (base * base) % mod;
  }
  return result;
}
int main() {
  cin >> n;
  for (int c = 0; c < n; ++c) cin >> arr[c];
  len = ((int)((arr[0]).size()));
  unsigned long long sum = 0, cursum;
  for (int c = 0; c < n; ++c) {
    for (int i = 0; i < len; ++i) {
      mypow = ((len * 2) - (i * 2 + 1));
      cursum = (unsigned long long)(arr[c][i] - '0') * n * (Pow(10ll, mypow));
      mypow = ((len * 2) - (i * 2 + 2));
      cursum %= mod;
      cursum += (unsigned long long)(arr[c][i] - '0') * n * (Pow(10ll, mypow));
      sum += cursum;
      sum %= mod;
    }
  }
  cout << sum % mod << "\n";
  return 0;
}
