#include #include #include using namespace std; const int N = 60,mod=1e9+7; typedef long long LL; int cnt[N]; LL qpow(LL x,LL k){ LL res=1; while(k){ if(k&1)res=res*x%mod; x=x*x%mod; k>>=1; } return res; } int main(){ int n; scanf("%d",&n); for(int i=1;i<=9;i++){ scanf("%d",&cnt[i]); } LL t=1; LL c=1,res=0; for(int i=1;i<=n;i++){ t=t*i%mod; res=(res+c)%mod; c=c*10%mod; } LL ans=0; for(int i=1;i<=9;i++){ LL z=1; for(int j=1;j<=cnt[i];j++){ z=z*j%mod; } t=t*qpow(z,mod-2)%mod; } for(int i=1;i<=9;i++){ if(cnt[i]){ ans=(ans+t*cnt[i]%mod*i%mod*qpow(n,mod-2)%mod*res%mod)%mod; } } cout<