#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)998244353;
const long long INF = 1000000002;
long long n, ans = 0, x = 0, y = 0;
vector<long long> v(100001);
long long p[41];
void add(long long &a, long long b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
long long mult(long long a, long long b) { return (a % mod * b % mod) % mod; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  p[0] = 1;
  for (int i = 1; i <= 30; i++) {
    p[i] = p[i - 1] * 10 % mod;
  }
  for (int i = 0; i < n; i++) {
    long long cur = v[i];
    long long j = 1;
    while (cur) {
      x += ((cur % 10) * p[j]);
      j += 2;
      cur /= 10;
    }
  }
  for (int i = 0; i < n; i++) {
    long long cur = v[i];
    long long j = 0;
    while (cur) {
      y += ((cur % 10) * p[j]) % mod;
      j += 2;
      cur /= 10;
    }
  }
  add(ans, mult(x, n));
  add(ans, mult(y, n));
  cout << ans;
  return 0;
}
