2
0 1
 1
0

1
2
 1

#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
#define maxn 100005
#define ull unsigned long long
struct node{
	ull a[5];
	ull&operator [](int x){return a[x];}
	ull calc(){return a[0]-a[2];}
	node(){memset(a,0,sizeof a);}
	friend node operator +(node a,node b){
		node c;
		For(i,0,4)c[i]=a[i]+b[i];
		return c;
	}
	friend node operator *(node a,node b){
		ull t[10]; memset(t,0,sizeof t);
		For(i,0,4)if(a[i])
			For(j,0,4)t[i+j]+=a[i]*b[j];
		node c;
		For(i,0,4)c[i]=t[i]-t[i+5];
		return c;
	}
};
node w[23];
node f[maxn],t[maxn];
node qpow(node a,int b){
	node res; res[0]=1;
	while(b){
		if(b&1)res=res*a;
		a=a*a,b>>=1;
	}
	return res;
}
void fwt(node*a,int n,int typ)
{
	for(int o=1;o<n;o*=10)
		for(int i=0;i<n;i+=o*10)
			For(j,0,o-1)
			{
				For(x,0,9)t[i+j+x*o]=a[i+j+x*o],a[i+j+x*o]=node();
				For(x,0,9)For(y,0,9)
					a[i+j+x*o]=a[i+j+x*o]
						+t[i+j+y*o]*w[(10+typ*x)*y%10];
			}
}

signed main()
{
	int n=read();
	For(i,0,9)w[i][i%5]=(i>=5)?(-1):(1);
	For(i,1,n){
		int x=read();
		f[x][0]+=1;
	}
	fwt(f,100000,1);
	For(i,0,99999) f[i]=qpow(f[i],n);
	fwt(f,100000,-1);
	For(i,0,n-1){
		ull t=f[i].calc();
		t*=6723469279985657373ull; // inv of 5^5
		t>>=5,t%=(1ull<<58);
		printf("%d\n",t);
	}
    return 0;
}