#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int arr[30] = {0};
  unsigned long long sum = 0;
  long long int a, b, n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int j = 0;
    cin >> a;
    while (a != 0) {
      b = a % 10;
      arr[j] += b;
      arr[j + 1] += b;
      a /= 10;
      j += 2;
    }
  }
  for (unsigned long long int i = 0, ten = 1; i < 30; i++, ten = ten * 10) {
    if (!arr[i]) continue;
    arr[i] *= n;
    unsigned long long x =
        ((arr[i] % 998244353) * (ten % 998244353)) % 998244353;
    sum = (sum + x) % 998244353;
  }
  cout << sum << endl;
}
