2
0 1
 1
0

1
2
 1

#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) cout<<i<<" ";puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 1<<18|3;
int n,m,k,P[20],cnt[N];

struct num{
	ull a[10];
	num(){fil(a,0);}
	inline void clear(){
		fil(a,0);
	}
	inline num move(int x){
		num ans;
		FOR(i,0,k) ans.a[(i+x)%k]=a[i];
		return ans;
	}
	inline num operator + (const num &p)const{
		num ans;
		FOR(i,0,k) ans.a[i]=p.a[i]+a[i];
		return ans;
	}
	inline num operator * (const num &p)const{
		num ans;
		FOR(i,0,k) FOR(j,0,k) ans.a[(i+j)%k]=ans.a[(i+j)%k]+a[i]*p.a[j]; 
		return ans;
	}
};
inline num power(num a,int b){
	num ret;ret.a[0]=1;
	for (;b;b>>=1,a=a*a) if (b&1) ret=ret*a;
	return ret;
}

num f[N],F[N],g[N];
inline void DWT(num *f,int d,int op){
	if (d==0) return;
	FOR(i,0,k) DWT(f+i*P[d-1],d-1,op);
	FOR(i,0,P[d-1]) FOR(p,0,k) FOR(q,0,k) F[q*P[d-1]+i]=F[q*P[d-1]+i]+f[p*P[d-1]+i].move((k+op*p*q%k)%k);
	FOR(i,0,P[d]) f[i]=F[i],F[i].clear();
}

inline void simp(num &a){
    Dow(i,9,4){
        auto tmp=a.a[i];
        FOR(j,1,5){
            if (j&1) a.a[i-j]+=tmp;
            	else a.a[i-j]-=tmp;
        }
    }
}

int main(){
	n=read(),k=10,m=5;
	P[0]=1;
	For(i,1,m) P[i]=P[i-1]*k;
	For(i,1,n) cnt[read()]++;
	FOR(i,0,P[m]) f[i].a[0]=cnt[i];
	DWT(f,m,1);
	FOR(i,0,P[m]) f[i]=power(f[i],n);
	DWT(f,m,-1);
	ull inv5=14757395258967641293ull; 
	FOR(i,0,n) FOR(j,0,k) FOR(l,0,m) f[i].a[j]=f[i].a[j]*inv5;
	FOR(i,0,n) simp(f[i]),printf("%u\n",(f[i].a[0]/32)&((1ull<<58)-1));
}