#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
void boos() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void file() {
  freopen("dales.in", "r", stdin);
  freopen("dales.out", "w", stdout);
}
const long long INF = 1e9 + 7;
const long long INF1 = 998244353;
const long long LLINF = (long long)1e18;
const int INTmx = (int)1e9;
const int N = 2e5 + 1;
long long a[N];
long long b[N];
long long st[N];
int main() {
  boos();
  int n;
  cin >> n;
  long long kol = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long x = a[1];
  while (x) {
    kol++;
    x /= 10;
  }
  st[0] = 1;
  for (int i = 1; i <= 20; i++) {
    st[i] = (st[i - 1] * 10ll) % INF1;
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long tek = 0;
    while (a[i]) {
      b[i] += ((a[i] % 10) * st[tek + 1]) % INF1;
      if (b[i] >= INF1) b[i] -= INF1;
      sum += ((a[i] % 10) * st[tek]) % INF1;
      if (sum >= INF1) sum -= INF1;
      tek += 2;
      a[i] /= 10ll;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + sum + (b[i] * n) % INF1) % INF1;
  }
  cout << ans;
}
