#include <bits/stdc++.h>
using namespace std;
int n, a[100005], an[15];
inline int add(int a, int b) { return (1ll * a + b) % 998244353; }
inline int mult(int a, int b) { return (1ll * a * b) % 998244353; }
int main() {
  cin >> n;
  memset(an, 0, sizeof(an));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1, u = 0, v = 0, t = n; t; i++) {
    int sum = 0, nsum = 0;
    for (int j = 1; j <= n; j++)
      if (a[j]) {
        sum = add(sum, a[j]);
        nsum = add(nsum, a[j] % 10);
        a[j] /= 10;
        if (a[j] == 0) v++;
      }
    an[i] = add(an[i], add(mult(nsum, 11 * t), mult(sum, 2 * u)));
    t -= v;
    u = v;
    v = 0;
  }
  int ans = 0;
  for (int i = 10; i >= 1; i--) ans = add(mult(ans, 100), an[i]);
  printf("%d\n", ans);
  return 0;
}
