#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long N = 2e5 + 1;
const long long p = 998244353;
using namespace std;
long long b1[N];
long long b2[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n; i++) {
    long long x = arr[i];
    long long m = 1;
    long long ans1 = 0;
    while (x) {
      long long r = x % 10;
      x = x / 10;
      ans1 = (ans1 + r * m % p) % p;
      m = (m * 100) % p;
    }
    b1[i] = ans1;
    x = arr[i];
    m = 10;
    ans1 = 0;
    while (x) {
      long long r = x % 10;
      x = x / 10;
      ans1 = (ans1 + r * m % p) % p;
      m = (m * 100) % p;
    }
    b2[i] = ans1;
  }
  long long sum1 = 0, sum2 = 0;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans = (ans + ((n * b1[i]) % p + (n * b2[i]) % p) % p) % p;
  }
  for (long long i = 0; i < n; i++) ans = ans + (b1[i] % p) * sum2 % p;
  cout << ans;
}
