#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0LL;
  long long n, m;
  cin >> n;
  m = n;
  while (n--) {
    string s;
    cin >> s;
    long long nw = 0;
    for (int i = 0; i < s.size(); i++) {
      nw = nw * 10LL + (long long)(s[i] - '0');
      nw *= 10LL;
      if (nw >= 998244353) nw %= 998244353;
    }
    long long w = nw * m;
    w %= 998244353;
    ans += w;
    ans %= 998244353;
    nw = 0;
    for (int i = 0; i < s.size(); i++) {
      nw = nw * 10LL + (long long)(s[i] - '0');
      if (i != (s.size() - 1)) nw *= 10LL;
      if (nw >= 998244353) nw %= 998244353;
    }
    w = nw * m;
    w %= 998244353;
    ans += w;
    ans %= 998244353;
  }
  cout << ans << endl;
}
