#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
const int mod=(int)1e9+7;

int n;
char ch[110];
int f[11];
LL dp[60][60][11][12];
LL inv[60];

LL pmod(LL x,int m){
	LL cnt=1;
	LL now=x;
	while (m){
		if (m&1) cnt=(cnt*now)%mod;
		now=(now*now)%mod;
		m/=2;
	}
	return cnt;
}

LL C(int x,int y){
	LL cnt=1;
	for (int i=0;i<y;i++) cnt=cnt*(x-i)%mod;
	cnt = cnt*inv[y] %mod;
	return cnt;
}
// x: odd
// y: even
LL gao(int x, int y, int now,int mo){
	if (now==10) return mo==0;
	if (dp[x][y][now][mo]) return dp[x][y][now][mo];
	
	int xx=x,yy=y;
	
	if (now==0) xx--;
	LL res=0;
	if (f[now]==0) res=gao(x,y,now+1,mo);
		else
	// C(xx,i)*C(yy,f[now]-i)
	for (int i=0;i<=f[now];i++)
		if (i<=xx && f[now]-i<=yy){
			int t=mo+(i+i-f[now])*now+11*1000;
			LL cnt=gao(x-i,y+i-f[now],now+1,t%11);
			//if (now==1) cout <<now<< " "<<t<<" "<<i<<" "<<cnt<<endl;
			cnt *= (C(xx,i)*C(yy,f[now]-i))%mod;
			cnt %= mod;
			
			res += cnt;
			res %= mod;
		}

	return dp[x][y][now][mo]=res;
}

int main(){
	
	inv[0]=1;
	for (int i=1;i<=50;i++){
		LL t=1;
		for (int j=2;j<=i;j++) t=(t*j)%mod;
		inv[i]=pmod(t,mod-2);
	}

	while (scanf("%s",ch)!=EOF){
		n=strlen(ch);
		if (n==1){
			printf("%d\n",((ch[0]-'0')==0));
			continue;
		}
		memset(f,0,sizeof(f));
		for (int i=0;i<n;i++) f[ch[i]-'0']++;
		memset(dp,0,sizeof(dp));
		LL ans = gao(n/2+n%2,n/2,0,0);
		printf("%lld\n",ans);
	}
	return 0;
}
