#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, temp, mid;
  int a[100010];
  long long int cnt = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    for (j = 1; a[i]; j *= 100) {
      temp = a[i] % 10;
      mid = temp * j % 998244353;
      mid = (mid * n) % 998244353;
      cnt += mid;
      cnt %= 998244353;
      mid = (mid * 10) % 998244353;
      cnt += mid;
      cnt %= 998244353;
      a[i] /= 10;
    }
  }
  cout << cnt << endl;
  return 0;
}
