2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
constexpr unsigned long long MOD = 1ULL << 58;
int n;
int digit[100000][5];
unsigned long long x[100000][5], y[10][5], z[5], w[5];
int ta;
unsigned long long po(unsigned long long base, unsigned long long ex) {
  unsigned long long ans = 1;
  while (ex) {
    if (ex & 1) ans = ans * base;
    base *= base;
    ex >>= 1;
  }
  return ans;
}
unsigned long long inv5 = po(5 * 5 * 5 * 5 * 5, (MOD >> 1) - 1);
int main() {
  for (int i = 0; i < 100000; i++) {
    ta = i;
    for (int j = 0; j < 5; j++) {
      digit[i][j] = ta % 10;
      ta /= 10;
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &ta);
    x[ta][0]++;
  }
  for (int i = 0, j = 1; i < 5; i++, j *= 10)
    for (int k = 0; k < 100000; k++)
      if (digit[k][i] == 0) {
        for (int l = 0, m = k; l < 10; l++, m += j)
          for (int p = 0; p < 10; p++)
            if (l & p & 1)
              for (int q = 0; q < 5; q++) y[p][(l * p + q) % 5] -= x[m][q];
            else
              for (int q = 0; q < 5; q++) y[p][(l * p + q) % 5] += x[m][q];
        for (int l = 0, m = k; l < 10; l++, m += j)
          memcpy(x[m], y[l], sizeof(z));
        memset(y, 0, sizeof(y));
      }
  for (int i = 0; i < 100000; i++) {
    w[0] = 1;
    ta = n;
    while (ta) {
      if (ta & 1) {
        for (int j = 0; j < 5; j++)
          for (int k = 0; k < 5; k++) z[(j + k) % 5] += w[j] * x[i][k];
        memcpy(w, z, sizeof(z));
        memset(z, 0, sizeof(z));
      }
      for (int j = 0; j < 5; j++)
        for (int k = 0; k < 5; k++) z[(j + k) % 5] += x[i][j] * x[i][k];
      memcpy(x[i], z, sizeof(z));
      memset(z, 0, sizeof(z));
      ta >>= 1;
    }
    memcpy(x[i], w, sizeof(z));
    memset(w, 0, sizeof(z));
  }
  for (int i = 0, j = 1; i < 5; i++, j *= 10)
    for (int k = 0; k < 100000; k++)
      if (digit[k][i] == 0) {
        for (int l = 0, m = k; l < 10; l++, m += j)
          for (int p = 0; p < 10; p++)
            if (l & p & 1)
              for (int q = 0; q < 5; q++)
                y[p][(100 - l * p + q) % 5] -= x[m][q];
            else
              for (int q = 0; q < 5; q++)
                y[p][(100 - l * p + q) % 5] += x[m][q];
        for (int l = 0, m = k; l < 10; l++, m += j)
          memcpy(x[m], y[l], sizeof(z));
        memset(y, 0, sizeof(y));
      }
  for (int i = 0; i < n; i++)
    printf("%llu\n", (((x[i][0] - x[i][1]) >> 5) * inv5) & (MOD - 1));
  return 0;
}
