#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1e5 + 10;
const int mod = 998244353;
int pw[30];
int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
int mult(int a, int b) { return (a * 1LL * b) % mod; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  pw[0] = 1;
  for (int i = 1; i < 30; ++i) pw[i] = mult(10, pw[i - 1]);
  int ans = 0;
  for (int i = 1; i < n + 1; ++i) {
    int x;
    cin >> x;
    int pos = 0;
    while (x) {
      int dig = x % 10;
      x /= 10;
      ans = add(ans, mult(n, mult(dig, pw[2 * pos])));
      ans = add(ans, mult(n, mult(dig, pw[2 * pos + 1])));
      ++pos;
    }
  }
  cout << ans << endl;
  return 0;
}
