#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MOD = 998244353;
void shuffle(int a, int b) {
  vector<int> res;
  while (a > 0 && b > 0) {
    res.push_back(b % 10);
    res.push_back(a % 10);
    b /= 10;
    a /= 10;
  }
  for (auto p : res) cout << p;
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  long long a;
  long long pwr;
  long long sum = 0;
  int par = 0;
  long long d;
  long long nw;
  for (int i = 0; i < n; i++) {
    cin >> a;
    pwr = 1;
    nw = a;
    while (a > 0) {
      sum += (a % 10) * pwr * n;
      sum %= MOD;
      pwr *= 100ll;
      pwr %= MOD;
      a /= 10;
    }
    a = nw;
    pwr = 10;
    while (a > 0) {
      sum += (a % 10) * pwr * n;
      sum %= MOD;
      pwr *= 100ll;
      pwr %= MOD;
      a /= 10;
    }
  }
  cout << sum;
  return 0;
}
