#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 998244353;
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long ret = 1;
  while (y--) ret *= x, ret %= mod;
  return ret;
}
int main() {
  long long n;
  cin >> n;
  string second[n];
  for (int i = 0; i < n; i++) cin >> second[i];
  long long len = second[0].size(), ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < len; j++) {
      long long x = second[i][j] - '0';
      ans += n * x * power(10, len * 2 - j * 2 - 1), ans %= mod;
      ans += n * x * power(10, len * 2 - j * 2 - 2), ans %= mod;
    }
  }
  cout << ans << endl;
}
