#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
char a[maxn][11];
char b[21];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int len = strlen(a[0]);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int k = 0;
    long long sum = 0;
    for (int j = 0; j < len; j++) {
      b[k++] = a[i][j];
      b[k++] = a[i][j];
    }
    for (int j = 0; j < 2 * len; j++) {
      sum = sum * 10 + b[j] - '0';
      sum %= 998244353;
    }
    sum = sum * n % 998244353;
    ans += sum;
    ans %= 998244353;
  }
  cout << ans;
  return 0;
}
