#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
const int maxn = 300005;
long long c[maxn];
int main() {
  int n;
  c[0] = 1;
  for (int i = 1; i <= 18; i++) c[i] = c[i - 1] * 10 % 998244353;
  scanf("%d", &n);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    string x;
    cin >> x;
    int len = x.length();
    int d = 0;
    for (int j = len - 1; j >= 0; j--) {
      ans += (n)*10 * c[d * 2] * (x[j] - '0') % 998244353;
      ans %= 998244353;
      ans += (n)*c[d * 2] * (x[j] - '0') % 998244353;
      ans %= 998244353;
      d++;
    }
  }
  cout << ans << endl;
  return 0;
}
