#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long ans = 0;
char t[15];
long long p[25];
int main() {
  p[0] = 1;
  for (int i = 1; i <= 21; i++) p[i] = 10 * p[i - 1] % mod;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long q = 0;
    int k = 0;
    scanf("%s", t + 1);
    int len = strlen(t + 1);
    len *= 2;
    for (int j = 2; j <= len; j += 2)
      q = (q + (long long)(t[++k] - '0') * p[len - j] % mod) % mod;
    ans = (n * q % mod + n * q * 10 % mod + ans) % mod;
  }
  printf("%I64d\n", ans);
  return 0;
}
