#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t, n, i, j, k, ans;
  t = 1;
  while (t--) {
    ans = 0;
    cin >> n;
    long long a[n + 2];
    for (i = 0; i < n; i++) cin >> a[i];
    long long x = a[0];
    k = 0;
    while (x) {
      k++;
      x /= 10;
    }
    x = k;
    long long sum[k + 2];
    long long temp;
    while (k) {
      temp = 0;
      for (i = 0; i < n; i++) {
        temp += a[i] % 10;
        a[i] /= 10;
      }
      sum[k - 1] = (temp * n) % mod;
      k--;
    }
    long long base = 1, carry = 0, flag = 0;
    for (i = x - 1; i >= 0; i--) {
      while (flag < 2) {
        ans = ((ans % mod) + (base * ((sum[i] + carry) % 10)) % mod) % mod;
        base = ((base % mod) * 10) % mod;
        carry = (sum[i] + carry) / 10;
        flag++;
      }
      flag = 0;
    }
    ans = ((ans % mod) + (base * carry) % mod) % mod;
    cout << ans << "\n";
  }
  return 0;
}
