#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
const int mod=(int)1e9+7;
int C[10];
LL dp[11][105][12][2], Cb[105][105];
inline int mul(LL a,LL b) {
	a*=b;	a%=mod;
	return a;
}
inline int add(LL a,LL b) {
	a+=b;	a%=mod;
	return a;
}
LL gao(int curdplus,int oc,int ec,int osube,bool use) {
	LL &res=dp[curdplus][oc][osube][use];
	int curd=curdplus-1;
	if(~res)		return res;
	if(curd==-1)	return res=((int)abs(osube))%11==0;
	res=0;	int c=C[curd];	
	for(int o=0;o<=min(oc,c);++o) {
		int e=c-o;
		if(e>ec)	continue;		
		LL r;
		{			
			if(!use) {
				//use first pos
				if(curd && o) {
					r=mul(Cb[oc-1][o-1], Cb[ec][e]);					
					r=mul(r, gao(curdplus-1, oc-o, ec-e, ((osube+(o-e)*curd)%11+11)%11, 1));
					res=add(res,r);
				}
				// do not use
				if(oc>o) {
					r=mul(Cb[oc-1][o], Cb[ec][e]);					
					r=mul(r, gao(curdplus-1, oc-o, ec-e, ((osube+(o-e)*curd)%11+11)%11, use));
					res=add(res,r);
				}	
			}else {
				r=mul(Cb[oc][o], Cb[ec][e]);
				r=mul(r, gao(curdplus-1, oc-o, ec-e, ((osube+(o-e)*curd)%11+11)%11, use));
				res=add(res,r);
			}			
		}		
	}
	return res;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("E.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);		cin.tie(0);
    Cb[0][0]=1;
    FOR(i,1,100)
    FOR(j,0,i) {
    	if(!j)	Cb[i][j]=1;
    	else	Cb[i][j]=(Cb[i-1][j]+Cb[i-1][j-1])%mod;
    }
    char num[105];
    while(scanf("%s",num)==1) {
    	CLR(C,0);
    	int n=0;
    	for(char *s=num;*s;++s)	++C[*s-'0'],++n;
    	CLR(dp,-1);    	
    	LL res=gao(10,(n+1)/2,n/2,0,0);
    	printf("%lld\n",res);
    }
    return 0;
}