#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const long long MAX = 1e5 + 3;
long long n, arr[MAX];
long long exp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    b >>= 1;
    a = (a * a) % MOD;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long res = 0;
  for (long long i = 0; i < n; i++) {
    long long x = arr[i];
    long long c = 0;
    while (x != 0) {
      long long digit = x % 10;
      res += (((digit * exp(10, 2 * c)) % MOD) * n) % MOD;
      res += (((digit * exp(10, 2 * c + 1)) % MOD) * n) % MOD;
      x /= 10;
      c++;
    }
  }
  cout << (res) % MOD;
  return 0;
}
