#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
inline int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
inline int mul(int a, int b) { return int(1LL * a * b % mod); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int pw = 1;
  int ans = 0;
  int t = (int)s[0].size();
  for (int i = 0; i < t; i++) {
    for (string xd : s) {
      int at = mul(xd.back() - '0', pw);
      ans = add(ans, mul(at, n));
    }
    pw = mul(pw, 10);
    for (string &xd : s) {
      int at = mul(xd.back() - '0', pw);
      ans = add(ans, mul(at, n));
      xd.pop_back();
    }
    pw = mul(pw, 10);
  }
  cout << ans << '\n';
  return 0;
}
