#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a > b) {
    swap(a, b);
  }
  if (a == 0) return b;
  return gcd(b % a, a);
}
int invertBits(int num) {
  int x = log2(num) + 1;
  for (int i = 0; i < x; i++) num = (num ^ (1 << i));
  return num;
}
string add(string f, string s) {
  reverse(f.begin(), f.end());
  reverse(s.begin(), s.end());
  int i = 0, j = 0;
  string t = "";
  int carry = 0;
  while (i < f.size() && j < s.size()) {
    int k = (f[i] - '0') + (s[j] - '0') + carry;
    carry = k / 10;
    int sum = k % 10;
    t += (sum + '0');
    i++;
    j++;
  }
  while (i < f.size()) {
    int k = (f[i] - '0') + carry;
    carry = k / 10;
    int sum = k % 10;
    t += (sum + '0');
    i++;
  }
  while (j < s.size()) {
    int k = (s[j] - '0') + carry;
    carry = k / 10;
    int sum = k % 10;
    t += (sum + '0');
    j++;
  }
  if (carry) {
    t += (carry + '0');
  }
  reverse(t.begin(), t.end());
  return t;
}
int mulmod(int a, int b, int mod) {
  int res = 0;
  a = a % mod;
  while (b > 0) {
    if (b % 2 == 1) res = (res + a) % mod;
    a = (a * 2) % mod;
    b /= 2;
  }
  return res % mod;
}
int main() {
  long long int n;
  long long int m = 998244353;
  cin >> n;
  long long int i, a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0;
  for (i = 0; i < n; i++) {
    long long int k = a[i];
    long long int mul = 1;
    while (k != 0) {
      long long int r = k % 10;
      ans = (ans % m + ((r % m) * (mul % m) * (n % m)) % m) % m;
      mul = mul * 10;
      mul = mul % m;
      ans = (ans % m + ((r % m) * (mul % m) * (n % m)) % m) % m;
      mul = mul * 10;
      mul = mul % m;
      k = k / 10;
    }
  }
  cout << (ans + m) % m;
  return 0;
}
