#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 1e6 + 5;
char s[20];
int P = 998244353;
long long qmul(long long a, long long b, long long p) {
  long long res = 0;
  while (b) {
    if (b & 1) res = (res + a) % p;
    a = (a + a) % p;
    b >>= 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long res = 0;
  cin >> s;
  int len = strlen(s);
  long long tmp, b;
  tmp = 0, b = 1;
  for (int i = len - 1; i >= 0; i--) {
    int x = s[i] - '0';
    tmp = (tmp + x * b) % P;
    b = (b * 100) % P;
  }
  res = (res + (tmp * n)) % P;
  tmp = 0, b = 10;
  for (int i = len - 1; i >= 0; i--) {
    int x = s[i] - '0';
    tmp = (tmp + x * b) % P;
    b = (b * 100) % P;
  }
  res = (res + (tmp * n)) % P;
  for (int i = 2; i <= n; i++) {
    cin >> s;
    tmp = 0, b = 1;
    for (int i = len - 1; i >= 0; i--) {
      int x = s[i] - '0';
      tmp = (tmp + x * b) % P;
      b = (b * 100) % P;
    }
    res = (res + (tmp * n)) % P;
    tmp = 0, b = 10;
    for (int i = len - 1; i >= 0; i--) {
      int x = s[i] - '0';
      tmp = (tmp + x * b) % P;
      b = (b * 100) % P;
    }
    res = (res + (tmp * n)) % P;
  }
  cout << res << '\n';
}
