#include <bits/stdc++.h>
const double eps = 1e-7, PI = 3.1415926;
const int N = 5e5, M = 998244353;
using namespace std;
long long n, m, k = 1, x, y, a[N], mx = -1, mn = 1e9, sum;
char c[N];
string s;
map<int, bool> mp;
vector<int> vec;
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    k = 1;
    while (a[i]) {
      sum += (n * (a[i] % 10) * (k % M)) % M;
      k *= 10;
      k %= M;
      sum += (n * (a[i] % 10) * (k % M)) % M;
      k *= 10;
      k %= M;
      a[i] /= 10;
    }
  }
  cout << sum % M;
  return 0;
}
