#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 998244353;
const long long int INF = 1000111000111000111LL;
long long int modular_exp(long long int base, long long int exp,
                          long long int mod) {
  long long int ans = 1;
  while (exp) {
    if (exp % 2) ans = ans % mod * base % mod;
    base = ((base) * (base)) % mod;
    exp /= 2;
    ans %= mod;
  }
  return ans;
}
long long int fun1(string s) {
  long long int ans = 0;
  long long int l = s.length() - 1;
  long long int exp = 0;
  for (long long int i = l; i >= 0; i--) {
    ans = (s[i] - '0') % MOD * modular_exp(10, exp, MOD) + ans;
    ans %= MOD;
    exp += 2;
  }
  return ans % MOD;
}
long long int fun2(string s) {
  long long int ans = 0;
  long long int l = s.length() - 1;
  long long int exp = 1;
  for (long long int i = l; i >= 0; i--) {
    ans = (s[i] - '0') * modular_exp(10, exp, MOD) + ans;
    ans %= MOD;
    exp += 2;
  }
  return ans % MOD;
}
int32_t main() {
  long long int n;
  cin >> n;
  string a[n];
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    long long int t1 = fun1(a[i]) * n;
    t1 %= MOD;
    long long int t2 = fun2(a[i]) * n;
    t2 %= MOD;
    ans += (t1 + t2);
    ans %= MOD;
  }
  cout << (ans + MOD) % MOD;
  return 0;
}
