#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long arr[100005];
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  cin >> N;
  long long ans = 0;
  for (long long i = 1; i <= N; i++) {
    cin >> arr[i];
    long long jari = 1;
    while (arr[i] > 0) {
      ans = (ans + ((arr[i] % 10) * jari)) % mod;
      jari *= 10;
      jari %= mod;
      ans = (ans + ((arr[i] % 10) * jari)) % mod;
      jari *= 10;
      jari %= mod;
      arr[i] /= 10;
    }
  }
  cout << (ans * N) % mod;
}
