#include <bits/stdc++.h>
using namespace std;
inline long long max2(long long a, long long int b) {
  return (a) > (b) ? (a) : (b);
}
inline long long max3(long long a, long long b, long long c) {
  return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c));
}
inline long long min2(long long a, long long b) {
  return (a) < (b) ? (a) : (b);
}
inline long long min3(long long a, long long b, long long c) {
  return (a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c));
}
using namespace std;
const long long modu = 998244353;
long long dr8[] = {0, 0, 1, -1, 1, 1, -1, -1};
long long dc8[] = {1, -1, 0, 0, -1, 1, -1, 1};
long long dr4[] = {0, 1, -1, 0};
long long dc4[] = {1, 0, 0, -1};
inline void deb_vi(vector<long long> a) {
  for (long long i = 0; i < a.size(); i++) cout << a[i] << " ";
}
inline void deb_vll(vector<long long> a) {
  for (long long i = 0; i < a.size(); i++) cout << a[i] << " ";
}
inline bool is_palindrome(const string& s) {
  return std::equal(s.begin(), s.end(), s.rbegin());
}
using namespace std::chrono;
long long power(long long a, long long b) {
  long long result = 1;
  while (b) {
    if (b & 1) result = result * a % modu;
    a = (a * a) % modu;
    b /= 2;
    result %= modu;
  }
  return result;
}
long long fun1(string s) {
  long long ans = 0;
  long long l = s.length() - 1;
  long long exp = 0;
  for (long long i = l; i >= 0; i--) {
    ans = (s[i] - '0') % modu * power(10, exp) + ans;
    ans %= modu;
    exp += 2;
  }
  return ans % modu;
}
long long fun2(string s) {
  long long ans = 0;
  long long l = s.length() - 1;
  long long exp = 1;
  for (long long i = l; i >= 0; i--) {
    ans = (s[i] - '0') % modu * power(10, exp) + ans;
    ans %= modu;
    exp += 2;
  }
  return ans % modu;
}
int32_t main() {
  auto start = high_resolution_clock::now();
  {
    long long n;
    cin >> n;
    string a[n];
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      long long t1 = fun1(a[i]) * n;
      t1 %= modu;
      long long t2 = fun2(a[i]) * n;
      t2 %= modu;
      ans += (t1 + t2);
      ans %= modu;
    }
    cout << (ans + modu) % modu;
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  return 0;
}
