#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n, long long lelo) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n == 2) return (a * a) % lelo;
  if (n % 2)
    return (a * power(a, n - 1, lelo)) % lelo;
  else
    return power(power(a, n / 2, lelo), 2, lelo) % lelo;
}
const long long mod = 1000000007;
const long long mod2 = 998244353;
const long long INF = 1e18;
const long long N = 1e6 + 16;
const long long M = 1e2 + 12;
void solve() {
  long long n;
  cin >> n;
  long long v[n];
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long ans = 0;
  long long p1 = v[0];
  long long cnt = 0;
  while (p1 != 0) {
    cnt++;
    p1 = p1 / 10;
  }
  for (long long i = 0; i < n; i++) {
    long long p = 0;
    string s = to_string(v[i]);
    for (long long j = 0; j < cnt; j++) {
      long long k = power(10, 2 * cnt - 2 * j - 1, mod2);
      p = (p + (((s[j] - '0') * k) % mod2)) % mod2;
    }
    for (long long j = 0; j < cnt; j++) {
      long long k = power(10, 2 * cnt - 2 * j - 2, mod2);
      p = (p + (((s[j] - '0') * k) % mod2)) % mod2;
    }
    p = (p * n) % mod2;
    ans = (ans + p + mod2) % mod2;
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  for (long long i = 0; i < t; i++) solve();
}
