#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, p, i, j, len, total = 0, sum;
  cin >> n;
  vector<string> arr(n);
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  len = 1;
  for (i = arr[0].size() - 1; i > -1; i--) {
    sum = 0;
    for (j = 0; j < n; j++) {
      p = arr[j][i] - '0';
      sum = (sum + (((p * n) % 998244353) * (len % 998244353))) % 998244353;
    }
    total = (total + (sum * 11) % 998244353) % 998244353;
    len *= 100;
  }
  cout << total % 998244353;
  return 0;
}
