#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long maxN = 1e5 + 5;
const long long N = 1e6;
long long n, m;
string a[maxN];
long long b[25];
void solve() {
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      long long t = a[i][j] - 48;
      b[j * 2] += t * n;
      b[j * 2 - 1] += t * n;
    }
  }
  for (long long i = m * 2; i >= 1; i--) {
    b[i - 1] += b[i] / 10;
    b[i] %= 10;
  }
  long long res = 0;
  long long t = 1;
  for (long long i = m * 2; i >= 0; i--) {
    t = t % mod;
    res = (res + (b[i] % mod) * t % mod) % mod;
    t *= 10;
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = " " + a[i];
  }
  m = a[1].size() - 1;
  solve();
  return 0;
}
