#include <bits/stdc++.h>
const int maxn = 1e5 + 11;
char str[maxn][11];
int sum[maxn][11];
long long tsum[maxn];
const int p = 998244353;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str[i]);
  }
  int len = strlen(str[1]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= len; j++) {
      sum[i][j] = str[i][j - 1] - '0';
    }
  }
  long long ans = 0, lans = 0, len2 = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= len; j++) {
      lans = (lans + sum[i][len - j + 1] * (long long)pow(10, 2 * j - 2)) % p;
    }
    tsum[++len2] = lans * 10 % p;
    ans = (ans + lans) % p;
    lans = 0;
  }
  long long pans = 0;
  for (int i = 1; i <= n; i++) {
    pans = (pans + tsum[i] * n + ans) % p;
  }
  printf("%lld\n", pans);
}
