//GIVE ME AC!!!!!!!!!!!!!!!!! //#pragma GCC target("avx") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include #define ll long long #define ld long double #define floatset() fixed<; using vi=vector; using vs=vector; using vc=vector; using vvl=vector; using P=pair; using vvc=vector; using vd=vector; using vp=vector

; using vb=vector; const int dx[8]={1,0,-1,0,1,-1,-1,1}; const int dy[8]={0,1,0,-1,1,1,-1,-1}; const ll inf=2e18; const ll MOD=1000000007; const ll mod=998244353; const double pi=acos(-1); template ostream &operator<<(ostream&os,const pair&p) { os< istream &operator>>(istream&is,pair&p) { is>>p.first>>p.second; return is; } template ostream &operator<<(ostream&os,const vector&v) { for(int i=0;i<(int)v.size();i++) { os< istream &operator>>(istream&is,vector&v) { for(T &in:v)is>>in; return is; } void scan(){} template void scan(Head&head,Tail&... tail) { cin>>head; scan(tail...); } template void print(const T &t) { cout << t << '\n'; } template void print(const Head &head, const Tail &... tail) { cout << head << ' '; print(tail...); } template void fin(const T &... a) { print(a...); exit(0); } template ll sum_(vector&v){ ll res=0; for(auto &e:v)res+=e; return res; } template inline bool chmax(T1&a,T2 b){return a inline bool chmin(T1&a,T2 b){return a>b&&(a=b,true);} ll fac[300100],inv[300100],facinv[300100]; void init(){ fac[0]=1; fac[1]=1; inv[1]=1; facinv[0]=1; facinv[1]=1; for(int i=2;i<=300000;i++){ fac[i]=(fac[i-1]*i)%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; facinv[i]=facinv[i-1]*inv[i]%MOD; } } ll COM(ll n,ll k) {return fac[n]*(facinv[k]*facinv[n-k]%MOD)%MOD;} long long modpow(long long a, long long n, long long m) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % m; a = a * a % m; n >>= 1; } return res; } ll modinv(ll a,ll m){ ll b=m,x=1,y=0; while(b>0){ x-=y*(a/b); swap(x,y); a=a%b; swap(a,b); } x=x%m; if(x>=0){ return x; } else{ return x+m; } } int main(){ LL(n); vl cnt(9); scan(cnt); ll ans=0; vl a(9,0); init(); rep(i,0,9){ ll m=n-1; ll now=1; if(cnt[i]==0)continue; cnt[i]--; rep(j,0,9){ now*=COM(m,cnt[j]); m-=cnt[j]; now%=MOD; } cnt[i]++; a[i]=now*(i+1)%MOD; } rep(i,0,n)ans+=modpow(10,i,MOD); ans%=MOD; //cout<