#include <bits/stdc++.h>
using namespace std;
long long n, i, j;
vector<long long> v;
long long ans, md, x, y;
int main() {
  md = 998244353;
  cin >> n;
  for (i = 1; i <= 40; ++i) v.push_back(0);
  for (i = 1; i <= n; ++i) {
    cin >> x;
    j = 0;
    while (x) {
      y = x % 10;
      x /= 10;
      v[j] += n * y;
      v[j + 1] += n * y;
      j += 2;
    }
  }
  long long cur = 1;
  for (j = 0; j <= 35; ++j) {
    if (j != 0) cur = (cur * 10) % md;
    x = ((v[j] % md) * cur) % md;
    ans = (ans + x) % md;
  }
  cout << ans;
}
