#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const long long INF = 1e9;
mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
long long rnd(long long l, long long r) {
  return (mt_rnd_64() % (r - l + 1)) + l;
}
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const double PI = acos(-1.0);
map<ll, ll> q;
ll ans = 0;
ll binpow(ll a, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return (binpow(a, n - 1) * a) % MOD;
  else {
    ll b = binpow(a, n / 2) % MOD;
    return (b * b) % MOD;
  }
}
int main() {
  cout.tie(0);
  cin.tie(0);
  cout << setprecision(10) << fixed;
  ios_base::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll c;
  vector<string> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    ll num = 0, num1 = 0, co = 0;
    for (int j = a[i].size() - 1; j >= 0; --j) {
      num = (num + (a[i][j] - '0') * binpow(10, 2 * co)) % MOD;
      num1 = (num1 + (a[i][j] - '0') * binpow(10, 2 * (co) + 1)) % MOD;
      ++co;
    }
    ans = (ans + num + num1) % MOD;
  }
  cout << (ans * n) % MOD;
  return 0;
}
