Problem: Let's define radix sum of number a consisting of digits a_1, … ,a_k and number b consisting of digits b_1, … ,b_k(we add leading zeroes to the shorter number to match longer length) as number s(a,b) consisting of digits (a_1+b_1)mod 10, … ,(a_k+b_k)mod 10. The radix sum of several integers is defined as follows: s(t_1, … ,t_n)=s(t_1,s(t_2, … ,t_n))

You are given an array x_1, … ,x_n. The task is to compute for each integer i (0 ≤ i < n) number of ways to consequently choose one of the integers from the array n times, so that the radix sum of these integers is equal to i. Calculate these values modulo 2^{58}.

Input

The first line contains integer n — the length of the array(1 ≤ n ≤ 100000).

The second line contains n integers x_1, … x_n — array elements(0 ≤ x_i < 100000).

Output

Output n integers y_0, …, y_{n-1} — y_i should be equal to corresponding number of ways modulo 2^{58}.

Examples

Input


2
5 6


Output


1
2


Input


4
5 7 5 7


Output


16
0
64
0

Note

In the first example there exist sequences: sequence (5,5) with radix sum 0, sequence (5,6) with radix sum 1, sequence (6,5) with radix sum 1, sequence (6,6) with radix sum 2.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void read(_T &f) {
  f = 0;
  _T fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      fu = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + (c & 15);
    c = getchar();
  }
  f *= fu;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x < 10)
    putchar(x + 48);
  else
    print(x / 10), putchar(x % 10 + 48);
}
template <typename T>
void print(T x, char t) {
  print(x);
  putchar(t);
}
unsigned long long fpow(unsigned long long x, unsigned long long y) {
  unsigned long long ans = 1;
  while (y) {
    if (y & 1) ans *= x;
    y >>= 1;
    x *= x;
  }
  return ans;
}
const int N = 1e5 + 5;
struct atom {
  unsigned long long a[5];
};
atom operator+(const atom a, const atom b) {
  atom ans;
  for (int i = 0; i <= 4; i++) ans.a[i] = a.a[i] + b.a[i];
  return ans;
}
atom operator-(const atom a, const atom b) {
  atom ans;
  for (int i = 0; i <= 4; i++) ans.a[i] = a.a[i] - b.a[i];
  return ans;
}
atom operator*(const atom a, const unsigned long long b) {
  atom ans;
  for (int i = 0; i <= 4; i++) ans.a[i] = a.a[i] * b;
  return ans;
}
atom operator*(const atom a, const atom b) {
  atom ans;
  static unsigned long long tem[9];
  memset(tem, 0, sizeof(tem));
  for (int i = 0; i <= 4; i++) {
    for (int j = 0; j <= 4; j++) {
      tem[i + j] += a.a[i] * b.a[j];
    }
  }
  for (int i = 0; i <= 4; i++) ans.a[i] = tem[i];
  for (int i = 5; i <= 8; i++) ans.a[i - 5] -= tem[i];
  return ans;
}
atom shift(atom a, int b) {
  int rev = (b % 10 >= 5);
  b %= 5;
  static unsigned long long tem[5];
  for (int i = 0; i <= 4; i++) {
    if (i + b <= 4)
      tem[i + b] = a.a[i];
    else
      tem[i + b - 5] = -a.a[i];
  }
  for (int i = 0; i <= 4; i++) {
    a.a[i] = tem[i];
    if (rev) a.a[i] = -a.a[i];
  }
  return a;
}
atom fpow(atom x, int y) {
  atom ans;
  memset(ans.a, 0, sizeof(ans.a));
  ans.a[0] = 1;
  while (y) {
    if (y & 1) ans = ans * x;
    y >>= 1;
    x = x * x;
  }
  return ans;
}
atom a[N];
int n;
void fwt(atom *a) {
  int n = 100000;
  for (int mid = 1; mid < n; mid *= 10) {
    for (int i = 0; i < n; i += (mid * 10)) {
      for (int j = 0; j < mid; j++) {
        atom tem[10];
        for (int k = 0; k < 10; k++) {
          atom res;
          memset(res.a, 0, sizeof(res.a));
          for (int t = 0; t < 10; t++) {
            res = res + shift(a[i + j + mid * t], k * t);
          }
          tem[k] = res;
        }
        for (int k = 0; k < 10; k++) a[i + j + mid * k] = tem[k];
      }
    }
  }
}
void ifwt(atom *a) {
  int n = 100000;
  for (int mid = 1; mid < n; mid *= 10) {
    for (int i = 0; i < n; i += (mid * 10)) {
      for (int j = 0; j < mid; j++) {
        atom tem[10];
        for (int k = 0; k < 10; k++) {
          atom res;
          memset(res.a, 0, sizeof(res.a));
          for (int t = 0; t < 10; t++) {
            res = res + shift(a[i + j + mid * t], k * t);
          }
          tem[k] = res;
        }
        reverse(tem + 1, tem + 10);
        for (int k = 0; k < 10; k++) a[i + j + mid * k] = tem[k];
      }
    }
  }
}
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    int x;
    read(x);
    ++a[x].a[0];
  }
  fwt(a);
  for (int i = 0; i < 100000; i++) a[i] = fpow(a[i], n);
  ifwt(a);
  unsigned long long inv = fpow(3125, (1ull << 63) - 1);
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 3; j++) assert(a[i].a[j] == -a[i].a[j + 1]);
    print((a[i].a[0] + a[i].a[1]) * inv / 32 % (1ull << 58), '\n');
  }
  return 0;
}