#include <bits/stdc++.h>
using namespace std;
const long long md = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0), cout.precision(10);
  int n;
  cin >> n;
  long long tmp, num = 1, ans = 0;
  string s;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    reverse(s.begin(), s.end());
    num = 1;
    tmp = 0;
    for (int j = 0; j < s.size(); ++j) {
      tmp = (s[j] - '0') * num;
      num *= 100;
      num %= md;
      tmp %= md;
      ans = (ans + tmp * n % md) % md;
    }
    tmp = 0;
    num = 10;
    for (int j = 0; j < s.size(); ++j) {
      tmp = (s[j] - '0') * num;
      num *= 100;
      num %= md;
      tmp %= md;
      ans = (ans + tmp * n % md) % md;
    }
  }
  cout << ans % md << endl;
  return 0;
}
