#include <bits/stdc++.h>
using namespace std;
int arr[110000];
long long po[25];
int digSum[25];
int digCnt(int v) { return log10(v) + 1; }
void pre() {
  po[0] = 1;
  for (int i = 1; i < 20; i++) po[i] = (po[i - 1] * 10) % 998244353;
}
int main() {
  pre();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int D = digCnt(arr[0]);
  for (int k = D; k >= 1; k--) {
    for (int i = 0; i < n; i++) {
      digSum[k] += (arr[i] % 10);
      arr[i] /= 10;
    }
  }
  long long sum = 0;
  int exp = 2 * D - 1;
  for (int i = 1; i <= D; i++) {
    long long v = (po[exp] + po[exp - 1]) % 998244353;
    v = (v * (digSum[i])) % 998244353;
    sum = (sum + v) % 998244353;
    exp -= 2;
  }
  long long res = n * sum;
  if (res > 998244353) res %= 998244353;
  while (res < 0) res += 998244353;
  cout << res << "\n";
  return 0;
}
