#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
#define MAX(type) numeric_limits<type>::max()
#define MIN(type) numeric_limits<type>::min()

template <class... Args>
auto create(size_t n, Args&&... args) {
    if constexpr (sizeof...(args) == 1) {
        return vector(n, args...);
    } else {
        return vector(n, create(args...));
    }
}

int modPow(int base, int exponent, int mod) {
    if (exponent == 0) {
        return 1 % mod;
    }
    ll u = modPow(base, exponent / 2, mod);
    u = (u * u) % mod;
    if (exponent % 2 == 1) {
        u = (u * base) % mod;
    }
    return u;
}

int mmi(int number, int prime) { return modPow(number, prime - 2, prime); }

int MOD = 1e9 + 7;
int add(int a, int b) { return (a + b) % MOD; }
int sub(int a, int b) { return (a - b + MOD) % MOD; }
int mul(int a, int b) { return ((ll)a * b) % MOD; }
int divide(int a, int b) { return mul(a, modPow(b, MOD - 2, MOD)); }

void solve() {
    int N;
    cin >> N;
    vector<int> A(10);
    for (int i = 0; i <= 9; i++) {
        cin >> A[i];
    }

    // dp[n][i] = Number of valid numbers using digits in [i, 9]
    // dp[n][i] = sum_(j in [a[i], n]){ C(n, j) * dp[n - j][i + 1] } valid for i != 0.
    // dp[n][0] = sum_(j in [a[0], n]){ C(n - 1, j) * dp[n - j][i + 1] }
    // dp[n][9] = (n >= A[9]) ? 1 : 0

    auto C = create(N + 1, N + 1, (int)0);
    C[0][0] = 1;
    for (int n = 1; n <= N; n++) {
        C[n][0] = 1;
        C[n][n] = 1;
        for (int k = 1; k < n; k++) {
            C[n][k] = add(C[n - 1][k - 1], C[n - 1][k]);
        }
    }

    auto dp = create(N + 1, 9 + 1, (int)0);
    for (int n = 0; n <= N; n++) {
        dp[n][9] = (n >= A[9]) ? 1 : 0;
    }
    for (int n = 0; n <= N; n++) {
        for (int i = 8; i >= 1; i--) {
            dp[n][i] = 0;
            for (int j = A[i]; j <= n; j++) {
                dp[n][i] = add(dp[n][i], mul(C[n][j], dp[n - j][i + 1]));
            }
        }
    }
    for (int n = 0; n <= N; n++) {
        dp[n][0] = 0;
        for (int j = A[0]; j <= n - 1; j++) {
            dp[n][0] = add(dp[n][0], mul(C[n - 1][j], dp[n - j][1]));
        }
    }

    int ans = 0;
    for (int n = 1; n <= N; n++) {
        ans = add(ans, dp[n][0]);
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(15);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve();
    }
    return EXIT_SUCCESS;
}

#include <iostream>

using namespace std;

const int MAX=100 + 10;
const long long DELTA=1000 * 1000 * 1000 + 7;
int number[10];

int n;
long long ans[10][MAX][MAX];
long long d[MAX][MAX];
long long ans_h[10][MAX];
long long sum;

void input(){
	cin >> n;
	for(int i=0;i<10;i=i+1){
		cin >> number[i];
	}
}

void make_d(){
	for(int i=0;i<MAX;i=i+1){
		d[i][0]=1;
	}
	for(int i=1;i<MAX;i=i+1){
		for(int j=1;j<=i;j=j+1){
			d[i][j]=(d[i-1][j-1]+d[i-1][j])%DELTA;
		}
	}
}

void make_ans_h(int x){
	for(int i=number[x];i<=n;i=i+1){
		for(int j=number[x];j<=i;j=j+1){
			ans_h[x][i]=(ans_h[x][i]+ans[x][i][j])%DELTA;
		}
	}
}

void make_ans(){
	for(int i=number[9];i<=n;i=i+1){
		ans_h[9][i]=1;
	}
	for(int i=8;i>0;i=i-1){
		for(int j=number[i];j<=n;j=j+1){
			for(int k=number[i];k<=j;k=k+1){
				ans[i][j][k]=(ans_h[i+1][j-k]*d[j][j-k])%DELTA;			}
		}
		make_ans_h(i);
	}
	for(int i=number[0];i<=n;i=i+1){
		for(int j=number[0];j<=i;j=j+1){
			ans[0][i][j]=(ans_h[1][i-j]*d[i-1][i-j-1])%DELTA;
		}
	}
	make_ans_h(0);
}

void output(){
	for(int i=0;i<=n;i=i+1){
		sum=sum+ans_h[0][i];
		sum=sum%DELTA;
	}
	cout << sum << endl;
}

int main(){
	input();
	make_d();
	make_ans();
	output();
	return 0;
}

//Hello. I'm Peter.
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
#define peter cout<<"i am peter"<<endl
#define randin srand((unsigned int)time(NULL))
#define INT (0x3f3f3f3f)*2
#define LL (0x3f3f3f3f3f3f3f3f)*2
#define input freopen("data.txt","r",stdin)
#define gsize(a) (int)a.size()
#define len(a) (int)strlen(a)
#define slen(s) (int)s.length()
#define clr(a) memset(a,0,sizeof(a))
#define clr_queue(q) while(!q.empty()) q.pop()
#define clr_stack(s) while(!s.empty()) s.pop()
#define rep(i, a, b) for (int i = a; i < b; i++)
#define dep(i, a, b) for (int i = a; i > b; i--)
#define repin(i, a, b) for (int i = a; i <= b; i++)
#define depin(i, a, b) for (int i = a; i >= b; i--)
#define esp 1e-6
#define MAXN
#define N 200
#define M
const ll mod=1e9+7;
ll C[N][N],ans,dp[15][N];
int n,a[N],sum;
void init_C(){
    clr(C);
    rep(i,0,N){
        C[i][0]=1;
    }
    rep(i,1,N){
        rep(j,1,N){
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
}
ll quick_power(ll x,ll y){
    if(!y) return 1;
    ll res=quick_power(x,y>>1);
    res=res*res%mod;
    if(y%2) res=res*x%mod;
    return res;
}
int main(){
//    input;
    init_C();
    ans=0;
    scanf("%d",&n);
    rep(i,0,10){
        scanf("%d",a+i);
    }
    repin(de,1,9){
        a[de]-=1;
        n-=1;
        repin(i,0,9){
            repin(j,0,n){
                dp[i][j]=0;
            }
        }
        repin(i,0,n){
            if(i>=a[0]) dp[0][i]=C[n][i];
        }
        repin(now,1,9){
            repin(i,0,n){
                if(i<a[now]) continue;
                repin(j,0,n){
                    if(i+j>n || !dp[now-1][j]) continue;
                    dp[now][i+j]=(dp[now][i+j]+dp[now-1][j]*C[n-j][i])%mod;
                }
            }
        }
        repin(i,0,n){
//            ans=(ans+dp[9][i]/C[n][n-i]);
            ans=(ans+dp[9][i]*quick_power(C[n][n-i],mod-2))%mod;
        }
        n+=1;
        a[de]+=1;
    }
    printf("%lld\n",ans);
}

#include <bits/stdc++.h>
using namespace std;
const int M = (int)1e9 + 7;
int a[17];
int c[107][107];
int dp[17][107];
int n;
int main()
{
	#ifndef ONLINE_JUDGE
		freopen("I.in","r",stdin);
	#endif
	cin>>n;
	for(int i=0;i<10;i++) cin>>a[i];
	for(int i=0;i<=100;i++) {
		c[i][0] = c[i][i] = 1;
		for(int j=1;j<i;j++) {
			c[i][j] = (c[i-1][j-1] + c[i-1][j]) % M;
		}
	}
	int ans = 0;
	dp[10][0] = 1;
	for(int dig=9;dig>=0;dig--) {
		for(int cnt=a[dig];cnt<=n;cnt++) {
			for(int rem=0;rem+cnt<=n;rem++) {
				dp[dig][cnt+rem] = (dp[dig][cnt+rem] + (dp[dig+1][rem]*1ll*c[cnt+rem-(dig?0:1)][cnt] % M)) % M;
			}
		}
	}
	for(int len=1;len<=n;len++) ans = (ans + dp[0][len]) % M;
	cout<<ans<<'\n';
	return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define maxn 109
using namespace std;
const int MOD=1000000007;
long long C[maxn][maxn],dp[maxn][20];
int a[maxn],n;
int main()
{
	for(int i=0;i<maxn;i++)
	{
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;j++)
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
	}
	scanf("%d",&n);
	for(int i=0;i<10;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<=n;i++)
	{
		if(i<a[9])
			dp[i][9]=0;
		else
			dp[i][9]=1;
		for(int j=8;j>=1;j--)
		{
			for(int k=a[j];k<=i;k++)
			{
				dp[i][j]=(dp[i][j]+dp[i-k][j+1]*C[i][k])%MOD;
			}
		}
	}
	long long ans=0;
	for(int i=max(1,a[0]);i<=n;i++)
	{
		for(int j=a[0];j<i;j++)
		{
			ans=(ans+dp[i-j][1]*C[i-1][j])%MOD;
		}
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include<bits/stdc++.h>
#include <queue>
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define inrange(x,y,n,m) (x>=0 && y>=0 && x<n && y<m)
const int N = 100;
const int mod = 1e9+7;
ll dp[10][N+100];
ll c[N+10][N+10];
int a[10];
void pre(){
    for(int i=0;i<=100;++i){
        c[i][0] = 1;
        c[i][i] = 1;
        c[i][1] = i;
    }
    c[0][0] = 1;
    for(int i=2;i<=100;++i){
        for(int j=2;j<=i;++j){
            c[i][j] = (c[i-1][j] + c[i-1][j-1])%mod;
        }
    }
}
int main(){
    pre();
    int n;
    cin>>n;
    int su = 0;
    for(int i=0;i<10;++i){
        cin>>a[i];
        su += a[i];
    }
    if(su>n){
        puts("0");
        return 0;
    }
    ll ans = 0;
    for(int len = su;len<=n;++len){
        memset(dp,0,sizeof(dp));
        for(int i = a[0];i<=len;++i){
            dp[0][i] = c[len-1][i];
        }
        for(int i=1;i<=9;++i){
            for(int j = a[i];j<=len;++j){
                for(int k = 0;k+j<=len;++k){
                    if(dp[i-1][k]){
                        (dp[i][k+j] += (dp[i-1][k]*c[len-k][j])) %= mod;
                    }
                }
            }
        }
        (ans += dp[9][len]) %= mod;
    }
    cout<<ans<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
inline ll tavan(ll a,ll n,ll mod) {ll p=1;while(n>0){if(n%2){p=p*a;p%=mod;}n>>=1;a*=a;a%=mod;}return p%mod;}
#define N (101)
#define INF ((ll)1e16)
#define MOD ((ll)1e9+7)

ll n,a[10],dp[2][N][10],c[N][N],ans;

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=0;i<N;i++)c[i][i]=c[i][0]=1;
	for(int i=1;i<N;i++)
		for(int j=1;j<i;j++)
			c[i][j]=c[i-1][j]+c[i-1][j-1],c[i][j]%=MOD;
	for(int i=0;i<10;i++)cin>>a[i],dp[0][0][i]=1;

	for(int i=1;i<=n;i++)
	{
		if(i>=a[0])dp[0][i][0]=1;
		for(int j=1,sum=a[0];j<10;sum+=a[j],j++)
			for(int k=a[j];k<=i-sum;k++)
			{
				dp[0][i][j]+=dp[0][i-k][j-1]*c[i][k],dp[0][i][j]%=MOD;
				if(k)dp[1][i][j]+=dp[0][i-k][j-1]*c[i-1][k-1],dp[1][i][j]%=MOD;
				dp[1][i][j]+=dp[1][i-k][j-1]*c[i-1][k],dp[1][i][j]%=MOD;
			}
		ans+=dp[1][i][9],ans%=MOD;
	}
	cout<<ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int N=200;
const long long base=1e9+7;
long long c[N][N],pw[N],dp[20][N];
int n,a[N];

void ckn_pw()
{
	for(int i=0;i<=100;i++)
		for(int j=0;j<=i;j++)
		{
			if(i==j || j==0) c[i][j]=1; else
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%base;
		}

}

int main()
{
	//freopen("i.inp","r",stdin);
	ckn_pw();
	cin>>n;
	for(int i=0;i<=9;i++) cin>>a[i];
	dp[10][0]=1;
	for(int i=9;i>0;i--)
		for(int j=0;j<=n;j++)
			for(int k=a[i];k<=j;k++)
				dp[i][j]=(dp[i][j]+dp[i+1][j-k]*c[j][k]%base)%base;
	long long ans=0;
	for(int j=0;j<=n;j++)
		for(int k=a[0];k<=j;k++)
			ans=(ans+dp[1][j-k]*c[j-1][k])%base;
	cout<<ans;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))

#define equal equalll
#define less lesss
const int N = 1111;
const long long INF = 1e9 + 19;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int MOD = 1e9 + 7;

int nn;
vector<int> cnt;
int c[N][N];
int dp[11][N];
int pref[N];

void read() {
    scanf("%d", &nn);
    cnt.resize(10);
    for (int i = 0; i < 10; i++)
        scanf("%d", &cnt[i]);
}

void upd(int &a, ll b) {
    a = (a + b) % MOD;
}

ll f(int n, vector<int> cc) {
    int sum = 0;
    for (auto x: cc)
        sum += x;

    if (sum > n) return 0;

    memset(dp, 0, sizeof(dp));
    int canAdd = n - sum;
    dp[0][canAdd] = 1;
    for (int i = 0; i < 10; i++)
        pref[i + 1] = pref[i] + cc[i];
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j <= canAdd; j++) {
            for (int t = 0; t <= j; t++) {
                int before = pref[i] + (canAdd - j);
                int empty = n - before;
                int cur = cc[i] + t;
                assert(empty >= cur);
                upd(dp[i + 1][j - t], dp[i][j] * 1ll * c[empty][cur]);
            }
        }
    }
    return dp[10][0];
}

void solve() {
    c[0][0] = 1;
    for (int i = 0; i <= nn; i++)
        for (int j = 0; j <= i; j++) {
            c[i + 1][j] = (c[i + 1][j] + c[i][j]) % MOD;
            c[i + 1][j + 1] = (c[i + 1][j + 1] + c[i][j]) % MOD;
        }
    int res = 0;
    for (int finLen = 1; finLen <= nn; finLen++) {
        for (int i = 1; i <= 9; i++) {
            auto tmp = cnt;
            tmp[i] = max(0, tmp[i] - 1);
            upd(res, f(finLen - 1, tmp));
        }
    }
    //int sum = 0;
    //for (auto x: cnt)
        //sum += x;
    //if (sum == 1)
        //upd(res, 1);
    //if (sum == 0)
        //upd(res, 10);

    cout << res << endl;
}

void stress() {

}

int main(){
#ifdef HOME
    freopen("in", "r", stdin);
#endif
    if (1) {
        read();
        solve();
    }
    else {
        stress();
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define present(c,val) ((c).find(val) != (c).end())
#define cpresent(c,val) (find(all(c),val) != (c).end())
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, x, y) for(int i= (x); i<= (y); ++i)
#define FORR(i, y, x) for(int i= (y); i>= (x); --i)

#define imax numeric_limits<int>::max()
#define imin numeric_limits<int>::min()
#define lmax numeric_limits<ll>::max()
#define lmin numeric_limits<ll>::min()
#define debug(var) cerr<<#var<<" = "<<(var)<<endl;
#define debugarr(var,n) cerr<<#var<<" = { ";rep(i,n) cerr<<var[i]<<" ";cerr<<"}"<<endl;
#define debugmat(var,m,n) cerr<<#var<<" = \n";rep(i,m) {rep(j,n) cerr<<var[i][j]<<" ";cerr<<endl;}
#define sci(var) scanf("%d",&(var))
#define scll(var) scanf("%lld",&(var))
#define MOD ((int)1e9+7)

int n,a[10],inv[105];
ll dp[105][10];

ll power(ll num, ll h) {
	if(!num) return 0;
	if(h==0) return 1;
	ll ans= power(num,h/2);
	if(h%2) return ((ans*ans)%MOD*num)%MOD;
	return (ans*ans)%MOD;
}

ll C(ll a, ll b) {
	if(a<0) return 0;
	if(!b) return 1;
	if(b>a) return 0;
	b=min(b,a-b);
	ll ans=1;
	ll b1=b;
	while(b--) ans=(ans*inv[b+1])%MOD;
	while(b1--) ans=(ans*(a--))%MOD;
	return ans;
}

void get(int ind, int digit) {
	if(dp[ind][digit]!=-1) return;
	if(digit==9) {
		dp[ind][digit]= ind>=a[9] ? 1 : 0;
		return;
	}
	dp[ind][digit]=0;
	for(int l=a[digit];l<=ind;l++) {
		get(ind-l,digit+1);
		if(digit) dp[ind][digit]=( dp[ind][digit]+ ( dp[ind-l][digit+1] * C(ind,l) )%MOD ) %MOD;
		else dp[ind][digit]=(dp[ind][digit]+(dp[ind-l][digit+1]*C(ind-1,l))%MOD ) %MOD;
	}
	return ;
}

int main() {
	cin>>n;
	int sm=0,ans=0;
	rep(i,10) cin>>a[i],sm+=a[i];
	inv[1]=1;
	FOR(i,2,102) inv[i]=power(i,MOD-2);
	if(sm>n) {cout<<0<<endl;return 0;}
	memset(dp,-1,sizeof dp);
	FOR(i,sm,n) {get(i,0);ans=(ans+dp[i][0])%MOD;}
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ll mod = 1000000007;

ll c[105][105], dp[10][105];
int a[10];

ll calc(int dig, int len){
    if(dig == 9)return len >= a[9];
    if(dp[dig][len] != -1)return dp[dig][len];
    ll ret = 0;
    for(int i = a[dig]; i <= len; i++){
        ret += c[len - (dig == 0)][i]*calc(dig + 1, len - i);
        ret %= mod;
    }
    return dp[dig][len] = ret;
}

int main(){

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<setprecision(30);

    int n;
    cin>>n;
    for(int i = 0; i < 10; i++){
        cin>>a[i];
    }
    memset(dp, -1, sizeof(dp));
    memset(c, 0, sizeof(c));
    c[0][0] = 1;
    for(int i = 1; i <= n; i++){
        c[i][0] = 1;
        for(int j = 1; j <= n; j++){
            c[i][j] = (c[i-1][j] + c[i-1][j-1])%mod;
        }
    }
    ll ans = 0;
    for(int len = 1; len <= n; len++){
        ans += calc(0, len);
        ans %= mod;
    }
    cout<<ans<<endl;
}

/*2018-06-02-12.13.09*/

#include<bits/stdc++.h>
#define ll long long int
#define N 110
using namespace std;

const ll mod=1e9+7;
ll fact[N];
int A[10];

inline ll power(ll a,ll b)
{
    if(b==0) return 1LL;
    ll temp=power(a,b/2);
    temp=(temp*temp)%mod;
    if(b%2) temp=(temp*a)%mod;
    return temp;
}

inline ll nCk(int n,int k)
{
    if(k>n) return 0LL;
    ll base=(fact[n-k]*fact[k])%mod;
    return (fact[n]*power(base,mod-2))%mod;
}

inline ll solve(int n,int flag)
{
    ll dp[n+1][10];
    for(int i=0;i<=n;i++) for(int j=0;j<10;j++) dp[i][j]=0;
    for(int i=A[0];i<=n;i++) dp[i][0]=1;
    for(int j=1;j<10;j++) for(int i=0;i<=n;i++)
    {
        for(int k=A[j];k<=i;k++)
            dp[i][j]=(dp[i][j]+dp[i-k][j-1]*nCk(i,k))%mod;
    }
    ll sum=0;
    for(int i=flag;i<=n;i++) sum=(sum+dp[i][9])%mod;
    return sum;
}

int main()
{
    int n;
    scanf("%d",&n);
    int sum=0;
    for(int i=0;i<10;i++) scanf("%d",&A[i]),sum+=A[i];

    if(sum>n) { printf("0\n"); return 0; }

    fact[0]=1;
    for(int i=1;i<N;i++) fact[i]=(fact[i-1]*i)%mod;

    ll ans=solve(n,1);
    if(A[0]) A[0]--;
    ans=(ans-solve(n-1,0)+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}

//lxrtxdy!
#include <bits/stdc++.h>
//typedef
//-------------------------#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;

#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;

    vector <ll> maxv;
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }

    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n){
        if(n&1) res = res * x;

        res %= mod;
        x = x * x %mod;
        n >>= 1;
    }
    return res;
}

#define SIEVE_SIZE 5000000+10
bool sieve[SIEVE_SIZE];
void make_sieve(){
    for(int i=0; i<SIEVE_SIZE; ++i) sieve[i] = true;
    sieve[0] = sieve[1] = false;
    for(int i=2; i*i<SIEVE_SIZE; ++i) if(sieve[i]) for(int j=2; i*j<SIEVE_SIZE; ++j) sieve[i*j] = false;
}

bool isprime(ll n){
    if(n == 0 || n == 1) return false;
    for(ll i=2; i*i<=n; ++i) if(n%i==0) return false;
    return true;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}
// 負の数にも対応した mod (a = -11 とかでも OK)
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}
ll GCD(ll a, ll b){

    if(b == 0) return a;
    return GCD(b, a%b);
}

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};
using Weight = int;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
    g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int n;
int a[10];
ll dp[101][11];
ll coef[101][101];

ll rec(int n, int c){
    if(!n){

        bool ok = false;
        for(int i=c; i<10; i++) ok |= !!a[i];

        return !ok;
    }
    if(c == 10) return 0;
    if(~dp[n][c]) return dp[n][c];
    dp[n][c] = 0;
    for(int i=a[c]; i<=n; i++){
        dp[n][c] = (dp[n][c] + coef[n][i] * rec(n-i, c+1))%MOD;
    }

    return dp[n][c];
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);

    cin >> n;
    int sum = 0;
    REP(i,10) {
        cin >> a[i];
        sum += a[i];

    }
    coef[0][0] = 1;
    for(int i=1; i<=100; i++){
        coef[i][0] = coef[i][i] = 1;

        for(int j=1; j<i; j++) coef[i][j] = (coef[i-1][j] + coef[i-1][j-1])%MOD;
    }

    ll ans = 0;
    for(int dig=1; dig<=n; dig++){
        for(int i = 1; i<10; i++){
            memset(dp, -1, sizeof(dp));

            bool u = !!a[i];
            a[i] -= u;
            ans = (ans + rec(dig-1, 0))%MOD;
            a[i] += u;
        }
    }
    cout << ans << endl;
    return 0;
}//hellobig_tq
//orzlxr!

#include<bits/stdc++.h>
using namespace std;
#define RESET(_x,_y) memset((_x),(_y),sizeof(_x))
#define SZ(_x) ((int)(_x).size())
#define LEN(_x) strlen(_x)
#define ALL(_x) (_x).begin(),(_x).end()
#define LL long long
#define ULL unsigned LL
#define PII pair<int,int>
#define VI vector<int>
#define VII vector< PII >
#define VVI vector< VI >
#define MP make_pair
#define PB push_back
#define FI first
#define SE second
const int INF=1e9;
const int MOD=1e9+7;
// >.<
int n,a[10];
LL dp[101][10],fac[101]={1},inv[101],all;
LL f(int x,int y){
	if(y>=10){
		if(x==0)return fac[all];
		return 0;
	}
	if(x<0)return 0;
	if(dp[x][y]!=-1)return dp[x][y];
	LL ret=0;
	for(int i=a[y];i<=100;i++){
		LL add=(f(x-i,y+1)*inv[i])%MOD;
		ret=(ret+add)%MOD;
	}
	return dp[x][y]=ret;
}
LL fast_pow(LL x,LL y){
	if(y==0)return 1;
	if(y==1)return x%MOD;
	LL ret=fast_pow(x,y/2);
	if(y%2==0)return (ret*ret)%MOD;
	return (((ret*ret)%MOD)*x)%MOD;
}
void prec(){
	for(int i=1;i<=100;i++)fac[i]=(fac[i-1]*i)%MOD;
	for(int i=0;i<=100;i++)inv[i]=fast_pow(fac[i],MOD-2);
}
int main(){
	prec();
	scanf("%d",&n);
	for(int i=0;i<10;i++)scanf("%d",&a[i]);
	LL an=0;
	for(int i=1;i<=n;i++){
		RESET(dp,-1);
		all=i;
		an=(an+f(i,0))%MOD;
		RESET(dp,-1);
		all=i-1;
		bool zero=0;
		if(a[0]>0){
			a[0]--;
			zero=1;
		}
		an=(an-f(i-1,0)+MOD)%MOD;
		if(zero)a[0]++;
	}
	printf("%lld\n",an);
	return 0;
}

/* Author - Neel Aryan (@neelaryan2) */
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "trace.h"
#else
#define trace(args...)
#endif

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()

const int kMod = 1e9 + 7;
struct ModInt {
    long long n;
    ModInt(long long n = 0) : n(n % kMod) {}
    ModInt operator+(const ModInt& oth) { return n + oth.n; }
    ModInt operator-(const ModInt& oth) { return n - oth.n; }
    ModInt operator*(const ModInt& oth) { return n * oth.n; }
    long long get() { return n < 0 ? n + kMod : n; }
};
ModInt lgpow(ModInt b, int e = -1) {
    if (b.get() == 0) return 0;
    ModInt r;
    e = e % (kMod - 1);
    if (e < 0) e += kMod - 1;
    for (r = 1; e; e >>= 1, b = b * b)
        if (e & 1) r = r * b;
    return r;
}
vector<ModInt> fact, invfact;
void factorials(int n) {
    fact.resize(n + 1, 1);
    invfact.resize(n + 1, 1);
    for (int i = 1; i <= n; ++i)
        fact[i] = fact[i - 1] * i;
    invfact[n] = lgpow(fact[n]);
    for (int i = n - 1; i >= 1; --i)
        invfact[i] = invfact[i + 1] * (i + 1);
}
ModInt choose(int n, int k) {
    if (n < 0 || k < 0 || k > n) return 0;
    return fact[n] * invfact[k] * invfact[n - k];
}
int a[10];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    factorials(200);
    int n;
    cin >> n;
    for (int i = 0; i < 10; i++)
        cin >> a[i];
    ModInt dp[n + 1][10], res, ans = 0;
    for (int j = 9; j >= 0; j--) {
        for (int i = 0; i <= n; i++) {
            dp[i][j] = 0;
            if (j == 9)
                dp[i][j] = int(i >= a[j]);
            else if (j == 0) {
                for (int k = a[j]; k <= i; k++) {
                    res = choose(i - 1, k);
                    res = res * dp[i - k][j + 1];
                    dp[i][j] = dp[i][j] + res;
                }
            } else {
                for (int k = a[j]; k <= i; k++) {
                    res = choose(i, k);
                    res = res * dp[i - k][j + 1];
                    dp[i][j] = dp[i][j] + res;
                }
            }
        }
    }
    for (int i = 1; i <= n; i++)
        ans = ans + dp[i][0];
    cout << ans.get() << '\n';
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define pb push_back
#define mod 1000000007

ll dp[101][10];
ll dp1[101][101];
int a[10];

ll ncr(int n,int r)
{
	if(r>n)
		return 0;
	if(r==0 || n==r)
		return 1;
	if(dp1[n][r]!=-1)
		return dp1[n][r];

	ll ans=0;
	ans+=ncr(n-1,r-1)+ncr(n-1,r);
	ans%=mod;

	dp1[n][r]=ans;
	return ans;
}

ll com(int len,int num)
{
	// cout<<"len: "<<len<<" num: "<<num<<endl;
	if(a[num]>len)
		return 0;
	if(dp[len][num]!=-1)
		return dp[len][num];

	if(num==9)
		return 1;

	ll ans=0;
	for(int i=a[num];i<=len;i++)
	{
		if(num==0 && len>=1)
		{
			ans+=com(len-i,num+1)*ncr(len-1,i);
		}
		else
			ans+=com(len-i,num+1)*ncr(len,i);
		ans%=mod;
	}

	dp[len][num]=ans;
	return ans;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	int n;
	cin>>n;

	for (int i = 0; i < 10; ++i)
	{
		cin>>a[i];
	}

	// memset(dp,-1,sizeof(dp));
	// memset(dp1,-1,sizeof(dp1));
	for (int i = 0; i < 101; ++i)
	{
		for(int j=0;j<101;j++)
		{
			dp1[i][j]=-1;
		}
		for(int j=0;j<10;j++)
		{
			dp[i][j]=-1;
		}
	}

	ll ans=0;

	for (int i = 1; i <= n; ++i)
	{
		ans+=com(i,0);
		ans%=mod;
	}

	cout<<ans<<endl;

}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <ctime>
#include <cstdlib>
#include <stack>
#include <map>
#include <set>
#include <list>

using namespace std;
const long long mod = 1000000007;
int n;
int a[10];
long long C[111][111];
long long dp[111][11];

int main()
{
    scanf("%d",&n);
    for (int i = 0; i < 10; i++)scanf("%d",a+i);
    for (int i = 0; i <= n; i++){
        C[i][0] = 1;
        for (int j = 1; j <= i; j++)
            C[i][j] = (C[i-1][j-1] + C[i-1][j]) % mod;
    }
    for (int i = 0; i <= n; i++){
        dp[i][9] = i>=a[9] ? 1 : 0;
        for (int j = 8; j > 0; j--)
            for (int k = a[j]; k <= i; k++)
                dp[i][j] += dp[i-k][j+1] * C[i][k],dp[i][j]%=mod;
        for (int k = a[0]; k<= i; k++)
            dp[i][0] += dp[i-k][1] * C[i-1][k],dp[i][0]%=mod;
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++)
        ans += dp[i][0],ans%=mod;
    printf("%I64d\n",ans);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n;
ll sz[10];
ll f[1005];
ll fi[1005];
ll powmod(ll a,ll b)
{
	ll an=1;
	while(b)
	{
		if(b&1)
		{
			an=(an*a)%MOD;
		}
		b>>=1;
		a=(a*a)%MOD;
	}
	return an;
}
vector<ll>a[10],res;
vector<ll>mul(vector<ll>&a,vector<ll>&b)
{
	vector<ll>c;
	c.clear();
	for(int j=1;j<=a.size()+b.size();j++)
		c.pb(0);
	for(int i=0;i<a.size();i++)
		for(int j=0;j<b.size();j++)
			c[i+j]=(c[i+j]+a[i]*b[j])%MOD;
	return c;
}
int main()
{
	f[0]=fi[0]=1;
	for(int i=1;i<=1000;i++)
	{
		f[i]=(f[i-1]*i)%MOD;
		fi[i]=powmod(f[i],MOD-2);
	}
	cin>>n;
	for(int i=0;i<=9;i++)
	{
		for(int j=0;j<=n;j++)
		{
			a[i].pb(0);
		}
	}
	for(int i=0;i<=9;i++)
	{
		ll x;
		cin>>x;
		sz[i]=x;
		for(int j=x;j<=n;j++)
		{
			a[i][j]=fi[j];
		}
	}
	ll ans=0;
	for(int i=1;i<=9;i++)
	{
		res.clear();
		res.pb(1);
		if(sz[i]>0)
			a[i][sz[i]-1]=fi[sz[i]-1];
		for(int j=0;j<=9;j++)
		{
			res=mul(res,a[j]);
		}
		for(int j=0;j<min(n,(ll)res.size());j++)
		{
			ans=(ans+(f[j]*res[j])%MOD)%MOD;
		}
		if(sz[i]>0)
			a[i][sz[i]-1]=0;
	}
	cout<<ans<<endl;
	return 0;
}

#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define PI                      3.1415926535897932384626
#define int                     long long int
#define fi                      first
#define se                      second
#define pq                      priority_queue
#define pb                      push_back
#define endl                    '\n'
#define all(x)                  x.begin(),x.end()
#define pii                     pair<int,int>
#define fill(x,y)               memset(x,y,sizeof(x));
#define fast                    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define hash                    _H
#define lg                      long double
#define vi                      std::vector<int>
#define sz(x)                   ((int)x.size())

template<typename T> T pow(T a,T b, int m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
template<typename T>T InverseMod(T a,int m){return pow(a,m-2,m);}
template<typename T>int SquareDist(T a,T b){int x = abs(a.fi - b.fi),y = abs(a.se - b.se); return x*x + y*y;}

const int N = 100+2;
const int mod = 1e9+7;

int n,a[10],C[N][N],dp[N][10+2];

int ncr(int n,int r) {
    if(C[n][r] != -1) {
        return C[n][r];
    }
    if(n < r) {
        C[n][r] = 0;
    }
    else if(r == 0) {
        C[n][r] = 1;
    }
    else
        C[n][r] = (ncr(n-1,r-1) + ncr(n-1,r))%mod;
    return C[n][r];
}

void solve() {
    fill(C,-1);
    fill(dp,0);
    cin >> n;
    for(int i = 0; i <= 9; ++i) cin >> a[i];
    dp[0][0] = 1;
    for(int len = 0; len <= n; ++len) {
        for(int d = 9; d >= 0 ; --d) {
            if(d == 9) {
                if(len >= a[9])
                    dp[len][d] = 1;
                else
                    dp[len][d] = 0;
            }
            else if(d == 0) {
                for(int j = a[d]; j <= len; ++j) {
                    dp[len][d] = (dp[len][d] + (dp[len-j][d+1] * ncr(len-1,j)) % mod) % mod;
                }
            }
            else {
                for(int j = a[d]; j <= len; ++j) {
                    dp[len][d] = (dp[len][d] + (dp[len-j][d+1] * ncr(len,j)) % mod) % mod;
                }
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i) {
        ans = (ans + dp[i][0])%mod;
    }
    cout << ans << endl;
}

signed main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,',');
    cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n;
int a[10];

int f[101];
int invf[101];
int cache[101][10];

void precal(){
    f[0]=1;
    invf[0]=1;
    for(int i=1; i<101; i++){
        f[i]=(i*f[i-1])%mod;
        invf[i]=power(f[i],mod-2);
    }
}

int ncr(int N, int R){
    int res=(((f[N]*invf[R])%mod)*invf[N-R])%mod;
    return res;
}

int dp(int n, int i){
    if(i==10) return (n==0);
    int &ans=cache[n][i];
    if(ans!=-1) return ans;
    ans=0;
    for(int j=a[i]; j<=n; j++){
        int numWays;
        if(i==0) numWays=(ncr(n-1,j)*dp(n-j,i+1))%mod;
        else numWays=(ncr(n,j)*dp(n-j,i+1))%mod;
        add(ans,numWays);
    }
    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    precal();
    cin >> n;
    rep(i,0,10) cin >> a[i];
    mst(cache,-1);
    int res=0;
    for(int i=1; i<=n; i++){
        add(res,dp(i,0));
    }
    cout << res;
    return 0;
}

// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,',');
    cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n;
int a[10];

int f[101];
int invf[101];
int cache[101][10];

void precal(){
    f[0]=1;
    invf[0]=1;
    for(int i=1; i<101; i++){
        f[i]=(i*f[i-1])%mod;
        invf[i]=power(f[i],mod-2);
    }
}

int ncr(int N, int R){
    int res=(((f[N]*invf[R])%mod)*invf[N-R])%mod;
    return res;
}

int dp(int n, int i){
    if(i==10){
        if(n==0) return 1;
        else return 0;
    }
    int &ans=cache[n][i];
    if(ans!=-1) return ans;
    ans=0;
    for(int j=a[i]; j<=n; j++){
        int numWays;
        if(i==0) numWays=(ncr(n-1,j)*dp(n-j,i+1))%mod;
        else numWays=(ncr(n,j)*dp(n-j,i+1))%mod;
        add(ans,numWays);
    }
    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    precal();
    cin >> n;
    rep(i,0,10) cin >> a[i];
    mst(cache,-1);
    int res=0;
    for(int i=1; i<=n; i++){
        add(res,dp(i,0));
    }
    cout << res;
    return 0;
}

#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
int fact[100100], A[110], B[110], dp[110][10], comb[110][110];
ll ln;
ll moduloexp(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=(1LL*res*a)%MOD;
		b/=2;
		a=(1LL*a*a)%MOD;
	}
	return res;
}
ll combe(ll n,ll r){
	if(n<r)
		return 0;
	return (1LL*fact[n]*moduloexp((1LL*fact[n-r]*fact[r])%MOD,MOD-2))%MOD;
}
void init(){
	fact[0]=1;
	for(int i=1;i<100010;i++)
		fact[i]=(1LL * fact[i-1]*i)%MOD;
}
int fun(int a, int b){
	//cerr << a << " " << b << " " << c << '\n';
	if(a == ln){
		if(b == 10)
			return 1;
	}
	if(dp[a][b] != -1)
		return dp[a][b];
	int ans = 0;
	if(b == 9){
		if(ln - a < B[9])
			ans = 0;
		else
			ans = (ans + (1LL * comb[ln - 1 - (a - 1)][ ln - a] * fun(ln, b + 1)) % MOD)  % MOD;
	}
	else{
		for(int i = a + B[b]; i <= ln; i++){
			ans = (ans + (1LL * comb[ln - 1 - (a - 1)][i - a] * fun(i, b + 1)) % MOD) % MOD;
		}
	}
	//cerr << a << " " << b << " " << c << " " << ans << " ANS\n";
	return dp[a][b] = ans;
}
ll rs(ll a, ll b){
	ll ans = 1;
	while(b){
		if(b & 1)
			ans = (a * ans) % MOD;
		b /= 2;
		a = (a * a) % MOD;
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	init();
	ll ans = 0;
	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= i; j++){
			comb[i][j] = combe(i, j);
		}
	}
	for(int i = 0; i < 10; i++)
		cin >> A[i];
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < 10; j++)
			B[j] = A[j];
		for(int j = 1; j <= 9; j++){
			B[j] = max(0, B[j] - 1);
			int cur = 0;
			for(int k = 0; k < 10; k++){
				cur += B[k];
			}
			if(cur > i - 1){
				if(B[j] < A[j])
					B[j]++;
				continue;
			}
			else{
				if(i == 1){
					ans = (ans + 1) % MOD;
				}
				else{
					memset(dp, -1, sizeof(dp));
					ln = i;
					ans = (ans + fun(1, 0)) % MOD;
					//cerr << B[1] << '\n';
					//cerr << i << ' ' << j << " " << ans << '\n';
				}
			}
			if(B[j] < A[j])
				B[j]++;
		}
		//cout << i << " " << ans << '\n';
	}
	cout << ans << '\n';

}

#include <iostream>

using namespace std;

#define MAXN 100
//#define MODN 1000000007
typedef long long ll;
ll MODN = 1000000007;

ll C[MAXN+1][MAXN+1] = {};
ll cb(int a,int b){
    if(b>a)
        return 0;

    if(a==b||a*b==0)
        return 1;

    if(!C[a][b]) {
        C[a][b]= ( cb(a-1,b-1) + cb(a-1, b) ) % MODN;
    }

    return C[a][b];
}

int main() {
    int n;
    while(cin >> n) {
        int a[10] = {};
        for(int i=0;i<10;++i){
            cin >> a[i];
        }
        // f[len][j] = number of numbers at length len using only digits d >= j
        ll f[MAXN+1][10] = {};
        for(int len=0;len<=n;++len) {
            for(int j=9;j>=0;--j){
                for(int i=a[j];i<=len;++i){
                    if(j==9){
                        f[len][9]=a[9]<=len? 1 : 0;
                    } else if(j>0) {
                        f[len][j] += (f[len-i][j+1]*cb(len,i))%MODN ;
                    } else {
                        f[len][0] += (f[len-i][1]*cb(len-1,i))%MODN;
                    }
                    f[len][j] %= MODN;
                }
            }
        }
        ll sum=0;
        for(int j=0;j<10;++j){
            for(int i=0;i<=n;++i){
                //cout << f[i][j] << " ";
                if(j==0) {
                    sum += f[i][j]%MODN;
                    sum %= MODN;
                }
            }
            //cout << endl;
        }

        cout << sum%MODN<< endl;
    }
    return 0;
}

/*
author: madhav_1999 aka orthodoxparadox
4 April 2020 at 4:12 AM
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define dbl long double
#define int ll
#define ll long long
#define pii pair<int, int>
#define len(x) (int) x.size()
#define rev(a) reverse(all(a))
#define oiint ostream_iterator<int>(cout, " ")
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vector
#define inf 2e18
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#ifdef MADHAV
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define dbg(...) 42
#endif
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(int i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct pair_hash {inline std::size_t operator()(const std::pair<int, int> & v) const {return v.first*31+v.second;}};
const int MOD = 1e9 + 7;

int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}

int fast_exp(int base, int expo, int mod = MOD) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;}
	return res;}

int modinv(int a, int mod = MOD){return takemod(fast_exp(takemod(a, mod), mod-2, mod), mod);}

const int N = 101;
int dp[10][N];
int choose[N][N];
int a[10];
int n;

int chooser(int n, int r) {
	if(r < 0 or r > n) return 0;
	if(r == 0 or r == n) return 1;
	if(choose[n][r]) return choose[n][r];
	return choose[n][r] = takemod(chooser(n - 1, r) + chooser(n - 1, r - 1));
}

int solver(int l, int s) {
	if(l > n or l < 0) return 0;
	if(dp[s][l] + 1) return dp[s][l];
	int &res = dp[s][l];
	res = 0;
	if(s == 9) {
		return res = (l >= a[9]);
	}
	else if(s > 0) {
		for(int i = a[s]; i <= l; i++) {
			res = takemod(res + takemod(chooser(l, i) * solver(l - i, s + 1)));
		}
	}
	else {
		for(int i = a[0]; i < l; i++) {
			res = takemod(res + takemod(chooser(l - 1, i) * solver(l - i, s + 1)));
		}
	}
	dbg(s, l, res);
	return res;
}

void solve()
{
	cin >> n;
	for(int i = 0; i < 10; i++) cin >> a[i];
	int ans = 0;
	initialise(dp, -1);
	for(int i = 1; i <= n; i++) {
		ans = takemod(ans + solver(i, 0));
	}
	cout << ans;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#ifdef MADHAV
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
	#endif
	clock_t t1, t2;
	t1 = clock();

	int tt = 1;
	// cin >> tt;
	while(tt--)
	{
		solve();
	}
	#ifdef MADHAV
	t2 = clock(); cerr << "time taken: " << (t2-t1)/(dbl)CLOCKS_PER_SEC;
	#endif
	return 0;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;

const double dbl_eps = 1e-14;
const int inf = 1e18;
const int mod = 1e9 + 7;

int bin_pow(int a, int n) {
    int res = 1;
    while (n > 0) {
        if (n % 2) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n /= 2;
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    int aa[10];
    int sum = 0;
    for (int i = 0; i < 10; ++i) {
        cin >> aa[i];
        sum += aa[i];
    }
    if (sum > n || aa[0] == n) {
        cout << "0\n";
        return;
    }
    vector<vector<int>> cc(n + 1, vector<int>(n + 1, 1));
    for (int i = 1; i < n; ++i) {
        cc[i][1] = i;
        cc[i][i + 1] = 0;
    }
    for (int i = 1; i <= n; ++i) {
        cc[i][i] = 1;
        for (int j = 1; j < i; ++j) {
            cc[i][j] = cc[i - 1][j - 1] + cc[i - 1][j];
            cc[i][j] %= mod;
        }
    }
    int ans = 0;
    for (int nn = sum; nn <= n; ++nn) {
        vector<vector<int>> dp(10, vector<int>(nn + 1, 0));
        for (int i = aa[0]; i < nn; ++i) {
            dp[0][i] = cc[nn - 1][i];
        }
        for (int i = 0; i < 9; ++i) {
            for (int j = 0; j <= nn; ++j) {
                for (int ii = aa[i + 1]; ii + j <= nn; ++ii) {
                    dp[i + 1][ii + j] += dp[i][j] * cc[nn - j][ii];
                    dp[i + 1][ii + j] %= mod;
                }
            }
        }
        ans += dp[9][nn];
        ans %= mod;
    }
    cout << ans;
    return;
}

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cin.tie(0);
    //cout.tie(0);
    //ios_base::sync_with_stdio(0);
    int q = 1;
    //cin >> q;
    while (q--) {
        solve();
    }
    return 0;
}

/*
 * if you are interested in the reference code here,
 * see https://github.com/georeth/OJLIBS for more information
 *
 * Solution Author : Georeth Chow <georeth2010@gmail.com>
 */
#include <cstdio>
#include <cmath>
#include <cstring>      // memset
#include <cstdlib>      // malloc
#include <cstdint>      // int64_t
#include <cinttypes>    // PRId64 SCNd64
#include <cassert>      // assert
#include <limits>       // numeric_limits
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <tuple>        // pair, tuple
#include <iostream>     // be careful
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
template <typename It>
struct iter_range : std::pair<It, It> {
    typedef std::pair<It, It> base_t;
    typedef It iterator;
    using base_t::base_t;
    It begin() { return base_t::first; }
    It end() { return base_t::second; }
};
template <typename It>
iter_range<std::reverse_iterator<It>> rev(const iter_range<It> &origin) {
    using rev_t = std::reverse_iterator<It>;
    return {rev_t(origin.second), rev_t(origin.first)};
}
// TODO: rev on std::string, etc.
template <typename Int = int>
struct int_iter {
    Int i;
    explicit int_iter(Int i = 0) : i(i) { }
    Int operator*() const { return i; }
    int_iter &operator++() { ++i; return *this; }
    int_iter &operator--() { --i; return *this; }
    int_iter operator+(Int step) const { return int_iter(i + step); }
    int_iter operator-(Int step) const { return int_iter(i - step); }
    Int operator-(const int_iter &that) const { return i - that.i; }
    int_iter &operator+=(Int step) { i += step; return *this; }
    int_iter &operator-=(Int step) { i -= step; return *this; }
    bool operator==(const int_iter &that) const { return  i == that.i; }
    bool operator!=(const int_iter &that) const { return !(*this == that); }
    Int operator[](Int n) { return i + n; }
    typedef Int difference_type;
    typedef Int value_type;
    typedef Int *pointer;
    typedef Int reference; // not a int container, never reference to int
    typedef std::random_access_iterator_tag iterator_category;
};
template <typename Int = int>
using int_range = iter_range<int_iter<Int>>;
template <typename Int>
int_range<Int> range(Int b, Int e) { return {int_iter<Int>(b), int_iter<Int>(e > b ? e : b)}; }
template <typename Int>
int_range<Int> range(Int n) { return range(Int(), n); }
template <typename Int>
int_range<Int> nrange(Int n) { return range(Int(1), Int(n+1)); }
template <typename Int>
int_range<Int> inrange(Int b, Int e) { return range(b, Int(e + 1)); }
using namespace std;    // use as solution header. name polution is fine.
#ifdef LOCAL_JUDGE
#  define pr_debug(...) fprintf(stderr, __VA_ARGS__)
#  define pr_line() fprintf(stderr, "%s: %d\n", __FILE__, __LINE__)
#else
#  define pr_debug(...)
#  define pr_line()
#endif
template <typename T>
bool chmax(T &m, const T &v) { if (v > m) return m = v, true; return false; }
template <typename T>
bool chmin(T &m, const T &v) { if (v < m) return m = v, true; return false; }
template <typename T>
T max_s(const T &v) { return v; }
template <typename T, typename... Args>
T max_s(const T &v1, const T &v2, Args... arg) {
    return max_s(max(v1, v2), arg...);
}
template <typename T>
T min_s(const T &v) { return v; }
template <typename T, typename... Args>
T min_s(const T &v1, const T &v2, Args... arg) {
    return min_s(min(v1, v2), arg...);
}
static const int HMAX32 = INT32_MAX / 2;
static const int64_t HMAX64 = INT64_MAX / 2;
#define fast_io\
    ios_base::sync_with_stdio(false); cin.tie(nullptr)
stringstream line_stream() {
    string str;
    getline(cin, str);
    return stringstream(str);
}
#define read_int(id) scanf("%d", &id)
#define read_int64(id) scanf("%" PRId64, &id)
#define new_int(id) int id; read_int(id)
#define new_int64(id) int64_t id; read_int64(id)
#define ALL(x) begin(x), end(x)
#include <type_traits>
// TODO : use gcc arith extension like __builtin_add_overflow
// try binary gcd on large number
template <typename Int>
Int gcd(Int a, Int b) {
    while (a != 0) {
        b %= a;
        if (b == 0)
            return a;
        a %= b;
    }
    return b;
}
template <typename Int, typename RInt = Int>
Int lcm(Int a, Int b) {
    return a / gcd(a, b) * static_cast<RInt>(b);
}
template <typename Int, typename XInt>
Int extended_gcd(Int a, Int b, XInt &x, XInt &y) {
    static_assert(std::numeric_limits<XInt>::is_signed,
            "x, y must be signed");
    // pre condition : a != 0 || b != 0
    // post condition : a * x + b * y = g
    // (a * x) or (b * y) may overflow, but the condition
    //                 always holds.
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    /**
     * r = a - b * q
     * b * k1 + r * k2 = g
     * => a * k2 + b * (k1 - q * k2)
     *                 x = k2
     *                 y = k1 - q * k2 = k1 - q * x
     */
    Int g = extended_gcd(b, a % b, y, x);
    y -= (a / b) * x;
    return g;
}
template <typename Int, typename TInt = int64_t>
Int mul_mod(Int a, Int b, Int m) {
    TInt p = a;
    p = (p * b) % m;
    return (Int)p;
}
template <typename Int, typename PInt, typename TInt = int64_t>
Int pow_mod(Int a, PInt p, Int m) {
    Int r;
    a %= m;
    for (r = 1; p; p >>= 1) {
        if (p & 1) r = mul_mod(r, a, m);
        a = mul_mod(a, a, m);
    }
    return r;
}
template <typename Int,
          typename XInt = typename std::make_signed<Int>::type>
Int inv_mod(Int a, Int m) {
    // a * x = gcd(a, m) (mod m)
    XInt x, y;
    extended_gcd(a, m, x, y);
    if (x < 0)
        return x + m;
    return x;
}
template <typename Int>
static Int addx_mod(Int u, Int v, Int m) {
    Int r = u + v;
    if (r >= m) r -= m;
    return r;
}
template <typename Int>
static Int subx_mod(Int u, Int v, Int m) {
    Int r = u - v;
    if (r < 0) r += m;
    return r;
}
template <typename Int>
Int div_pos_r(Int a, Int b, Int &r) {
    // 3 / 2  = 1 .. 1 (ok)
    // 3 / -2 = -1 .. 1 (ok)
    // -3 / 2 = -1 .. -1 (not ok)
    // -3 / -2 = 1 .. -1 (not ok)
    // a = q b + r
    //   = (q + 1) b + (r - b)
    //   = (q - 1) b + (r + b)
    Int q = a / b;
    r = a % b;
    if (r < 0) {
        if (b < 0)
            q += 1, r -= b;
        else
            q -= 1, r += b;
    }
    return q;
}
// TODO: gauss_factorial, factorial_mod.
//       log, factorial_exp
#define INV_MOD(x)      inv_mod((x), MOD)
#define MUL_MOD(x, y)   mul_mod((x), (y), MOD)
#define MULM_MOD(x, y)  (x) = mul_mod((x), (y), MOD)
#define POW_MOD(x, y)   pow_mod((x), (y), MOD)
#define ADDX_MOD(x, y)  addx_mod((x), (y), MOD)
#define ADDM_MOD(x, y)  (x) = addx_mod((x), (y), MOD)
#define SUBX_MOD(x, y)  subx_mod((x), (y), MOD)
#define SUBM_MOD(x, y)  (x) = subx_mod((x), (y), MOD)
// warning : mod is LARGE enough PRIME
struct factorial_list {
    std::vector<int> fact;
    int mod;
    factorial_list(int n, int mod) : fact(n + 1), mod(mod) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = mul_mod(fact[i - 1], i, mod);
    }
    int operator()(int n) { return fact[n]; }
    int A(int n, int m) {
        return mul_mod(fact[n], inv_mod(fact[n - m], mod), mod);
    }
    int C(int n, int m) {
        if (m > n || n < 0 || m < 0) return 0;
        return mul_mod(A(n, m), inv_mod(fact[m], mod), mod);
    }
    int H(int n, int m) {
        return C(n + m - 1, m);
    }
};
// C(n, m) = C(n, n - m)
// Be cautious about overflow
// try Lucas if n is large, but r is small
// e.g C(10^15, 10^4, 1e9 + 7)
#include <numeric>
/* =====  SOLUTION START  ===== */
int N, A[10];
static const int MOD = 1000000007;
int dp[105][12][105];
static const int maxc = 105;
int CC[maxc][maxc];
int C(int n, int m) {
    if (m > n || m < 0 || n < 0) return 0;
    return CC[n][m];
}
int solve(bool second) {
    memset(dp, 0, sizeof(dp));
    for (int n : inrange(0, N)) {
        dp[n][0][0] = 1;
        for (int i : range(10)) {
            for (int x : inrange(0, n))
                for (int r : inrange(A[i], n))
                    if (x + r <= n) ADDM_MOD(dp[n][i+1][x + r], MUL_MOD(dp[n][i][x], C(n - x, r)));
        }
    }
    int ans = 0;
    for (int i : inrange(second ? 0 : 1, N))
        ADDM_MOD(ans, dp[i][10][i]);
    return ans;
}
int main() {
    CC[0][0] = 1;
    for (int i : range(1, maxc)) {
        CC[i][0] = 1;
        for (int j : inrange(1, i))
            CC[i][j] = ADDX_MOD(CC[i - 1][j - 1], CC[i - 1][j]);
    }
    // fio();
    scanf("%d", &N);
    for (int i : range(10))
        scanf("%d", &A[i]);
    int ans = solve(false);
    // remove numbers with leading zero
    --N;
    if (A[0] > 0) --A[0];
    SUBM_MOD(ans, solve(true));
    printf("%d\n", ans);
    return 0;
}

#include<stdio.h>
#include<string.h>

typedef long long lld;
const int maxn=105;
const int Mod=1000000007;
int a[maxn];
lld C[maxn][maxn];
lld dp[maxn][maxn];
lld ans;

void Gao(int len)
{
	int i,j,k;
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(i=1;i<=10;i++)
		for(j=0;j<=len;j++)
			for(k=a[i];k+j<=len;k++)
			{
				if(i==1)
				{
					if(len>1 && len-j-1>=k)
						dp[i][j+k]=(dp[i][j+k]+dp[i-1][j]*C[len-j-1][k])%Mod;
					else if(len==1)
						dp[i][j+k]=(dp[i][j+k]+dp[i-1][j]*C[len-j][k])%Mod;
				}
				else if(i>1)
				{
					dp[i][j+k]=(dp[i][j+k]+dp[i-1][j]*C[len-j][k])%Mod;
				}
			}
	//printf("%lld\n",dp[10][len]);
	ans=(ans+dp[10][len])%Mod;
}

int main()
{
	int n;
	int i,j;
	for(i=0;i<maxn;i++)
	{
		C[i][0]=C[i][i]=1;
		for(j=1;j<i;j++)
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;
	}
	while(scanf("%d",&n)!=EOF)
	{
		a[0]=0;
		int sum=0;
		for(i=1;i<=10;i++)
		{
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		ans=0;
		for(i=1;i<=n;i++)
			Gao(i);
		if(sum==0)
			ans--;
		printf("%lld\n",ans);
	}
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
const unsigned long long  mod=1000000007;
int main() {
  unsigned long long combinatoria[101][101];
  unsigned long long dp[10][101];
  int numeros[10];
  int n;
  cin>>n;
  for(int i=0;i<10;++i)
    cin>>numeros[i];
  for(int i=0;i<101;++i){
    combinatoria[i][0]=1;
    combinatoria[i][1]=i;
    for(int j=2;j<i;++j){
      combinatoria[i][j]=(combinatoria[i-1][j]+combinatoria[i-1][j-1])%mod;
    }
    combinatoria[i][i]=1;
    for(int j=i+1;j<101;++j){
      combinatoria[i][j]=0;
    }
  }
  for(int i=0;i<numeros[9];++i){
    for(int j=0;j<10;++j)
      dp[j][i]=0;
  }
  for(int i=numeros[9];i<=n;++i){
    dp[9][i]=1;
    //cout<<i<<" "<<dp[9][i];
    for(int j=8;j>0;--j){
      dp[j][i]=0;
      for(int k=numeros[j];k<=i;++k){
        dp[j][i]+=(dp[j+1][i-k]*combinatoria[i][k])%mod;
        dp[j][i]%=mod;
      }
      //cout<<" "<<dp[j][i];
    }
    dp[0][i]=0;
    if(i){
    for(int k=numeros[0];k<=i;++k){
      dp[0][i]+=(dp[1][i-k]*combinatoria[i-1][k])%mod;
      dp[0][i]%=mod;
    }
    }
    //cout<<" "<<dp[0][i]<<endl;
  }
  int suma=0;
  for(int i=0; i<=n;++i)
    suma=(suma+dp[0][i])%mod;
  cout<<suma;
  //cout<<endl<<combinatoria[100][20];
}

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <map>
#include <string.h>

typedef long long ll;

const int N=110;
const int inf=0x3f3f3f3f;
const ll mod=1000000007ll;

using namespace std;

int n,a[110];

ll c[N][110];

void init()
{
	c[0][0]=1;
	for(int i=1;i<=100;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=100;j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
}

ll dp[11][N];

ll solve(int n,int a[])
{
	init();
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(dp[i][j]==0) continue;
			for(int k=a[i+1];k+j<=n;k++)
				dp[i+1][j+k]=(dp[i][j]*c[j+k][k]+dp[i+1][j+k])%mod;
		}
	}
	return dp[10][n];
}

int main()
{
	int sum=0;
	scanf("%d",&n);
	for(int i=1;i<=10;i++)
		scanf("%d",&a[i]),sum+=a[i];
	if(sum>n)
	{
		printf("0\n");
		return 0;
	}
	ll ret=0;
	for(int k=max(1,sum);k<=n;k++)
	{
		if(k==1)
		{
			if(sum==1) ret++;
			else ret+=9;
			continue;
		}
		for(int i=2;i<=10;i++)
		{
			int f=1;
			if(a[i]==0) f=0;
			a[i]-=f;
			ret+=solve(k-1,a);
			ret%=mod;
			a[i]+=f;
		}
	}
	cout<<(ret%mod)<<endl;
	return 0;
}

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))
#define min2(a,b) ((a)<(b) ? (a) : (b))
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();

int i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
lli dp[101][10],ncr[101][101];
int a[10];
lli ncrcalc(lli n,lli r)
{
  if(n<r || r<0 || n<0) return 0;
  if(n==r || r==0) return 1;
  if(ncr[n][r]!=0) return ncr[n][r];

  return ncr[n][r]=(ncrcalc(n-1,r-1)+ncrcalc(n-1,r))%mod;
}

lli compute(lli len,lli dig)
{
  if(len<0) return 0;
  if(dig==9 && len>=a[9]) return 1;
  else if(dig==9 && len<a[9]) return 0;
  else if(dp[len][dig]!=-1) return dp[len][dig];
  else if(dig==0)
  {
  	lli sum=0;

  	 int k;
  	 rep(k,a[0],len)
  	   sum=(sum + (compute(len-k,1)*ncrcalc(len-1,k))%mod )%mod;

    return dp[len][dig]=sum;
  }
  else
  {
  	lli sum=0;
  	 int k;
  	 rep(k,a[dig],len)
  	  sum=(sum + ( compute(len-k,dig+1)*ncrcalc(len,k) )%mod )%mod;

  	 return dp[len][dig]=sum;
  }
}
void solve()
{
	int n; cin>>n;
	memset(dp,-1,sizeof(dp));
	// int a[10]={0};
	rep(i,0,9) cin>>a[i];

   lli ans=0;
   rep(i,0,n) ans=(ans+compute(i,0))%mod;

   cout<<ans<<"\n";
}

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))
#define min2(a,b) ((a)<(b) ? (a) : (b))
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();

int i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
lli dp[101][10],ncr[101][101];
lli ncrcalc(lli n,lli r)
{
  if(n<r || r<0 || n<0) return 0;
  if(n==r || r==0) return 1;
  if(ncr[n][r]!=0) return ncr[n][r];

  return ncr[n][r]=(ncrcalc(n-1,r-1)+ncrcalc(n-1,r))%mod;
}

void solve()
{
	int n; cin>>n;
	int a[10]={0};
	rep(i,0,9) cin>>a[i];

	rep(i,0,n)
	  if(i>=a[9]) dp[i][9]=1;
	  else dp[i][9]=0;

  int k,l;

    rev(i,8,1)
      rep(j,0,n)
     	  {
     	  	lli sum=0;
     	  	 rep(k,a[i],j)
     	  	   sum=(sum + (dp[j-k][i+1]*ncrcalc(j,k))%mod )%mod;

     	  	 dp[j][i]=sum;
     	  }

   rep(j,0,n)
    {
      lli sum=0;
       rep(k,a[0],j)
          sum=(sum + (dp[j-k][1]*ncrcalc(j-1,k))%mod )%mod;

       dp[j][0]=sum;
    }

    lli ans=0;
    rep(i,0,n)
      ans=(ans + dp[i][0])%mod;

      cout<<ans<<"\n";

}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
ULL gcd(LL a,LL b){return b==0?a:gcd(b,a%b);}
ULL lcm(LL a,LL b){return a*(1LL)*(b/(1LL*gcd(a,b)));}
int n;
int a[10];
int dp[105][15];
int fact[105];
int cc[101][101];
int add(int x,int y){
	return (x+=y)<MOD?x:x-MOD;
}
int powr(int a,int b){
	if(b==0) return 1;
	if(b==1) return a;
	int t;
	t=powr(a,b/2);
	return b%2==0?(1LL*t*t)%MOD:(1LL*(1LL*t*t)%MOD*a)%MOD;
}
void pre(){
	int i,j;
	fact[0]=1;
	//rep(i,1,101) fact[i]=(1LL*fact[i-1]*i)%MOD;
	cc[0][0]=1;
	for(int i=1; i<=n; i++)
		for(int j=0; j<=i; j++)
			cc[i][j]=j==0||j==i?1:(cc[i-1][j]+cc[i-1][j-1])%MOD;
}
int inversemod(int n){
	return powr(n,MOD-2);
}
int c(int n,int r){
	int i,j,k;
	//return (1LL*fact[n]*(1LL*inversemod(fact[r])*inversemod(fact[n-r]))%MOD)%MOD;
	return cc[n][r];
}
int solve(int len,int j){
	if(dp[len][j]!=-1) return dp[len][j];
	int i,k;
	dp[len][j]=0;
	int ans=0;
	if(j==0) rep(i,a[0],len+1) ans=(ans+(1LL*solve(len-i,1)*c(len-1,i))%MOD)%MOD;
	if(j>0 && j<9) rep(i,a[j],len+1) ans=(ans+(1LL*solve(len-i,j+1)*c(len,i))%MOD)%MOD;
	if(j==9 && len>=a[9]) ans=1;
	return dp[len][j]=ans;
}
int main() {
	int i,j,k;
	cin>>n;
	pre();
	rep(i,0,10) cin>>a[i];
	mems(dp,-1);
	int ans=0;
	rep(i,1,n+1) ans=(ans+solve(i,0))%MOD;
	cout<<ans;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <map>
#include <cstring>
#include <complex>

using namespace std;

#define clr(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(b))
#define sz(a) ((int)a.size())

typedef long long ll;
typedef complex<double> point;
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<double, int> pdi;

const double PI = 3.14159265358979323;
const double eps=1e-12;
const int inf = (int)1e9;
const int MAX_N = 200 * 1000 + 1000;

int arr[100];

ll cm[111][111];

ll dp[111][111];
bool visit[111][111];

ll comp(ll n, ll k){
	if(k > n) return 0;
	if(k == 0 || k == n) return 1;
	if(cm[n][k] != -1) return cm[n][k];
	return cm[n][k] = (comp(n - 1, k - 1) + comp(n - 1, k))%(inf+7);
}

ll rec(int num, int len){
	if(len < arr[num]) return 0;
	if(num == 10){
		if(len == 0) return 1;
		else return 0;
	}
	ll &ref = dp[num][len];
	if(visit[num][len]) return ref;
	visit[num][len] = 1;
	ref = 0;
	for(int i = arr[num]; i <= len; i++){
		ll res = rec(num + 1, len - i);
		if(res == 0) continue;
		if(len - i > 0){
			int m = (num == 0 ? len - i : len - i + 1);
			ref += (res * comp(m + i - 1, i))%(inf+7);
			ref %= inf + 7;
		}
		else{
			if(num){
				ref++;
				ref %= inf + 7;
			}
		}
	}
	return ref;
}

int main(){
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);
	int n; cin >> n;
	for(int i = 0; i < 10; i++){
		cin >> arr[i];
	}
	clr(cm, -1);
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		ll res = rec(0, i);
		ans += res;
		ans %= inf + 7;
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <functional>
#include <cmath>

#if !defined(__GNUC__)
#include <hash_set>
#include <hash_map>

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;

typedef stdext::hash_set<size_t>    hash_set_size_t;
#else // !defined(__GNUC__)

#endif // !defined(__GNUC__)

typedef long double double_t;
typedef std::string string8_t;

typedef std::vector<size_t> vector_size_t;
typedef std::vector<int32_t> vector_int32_t;
typedef std::vector<uint32_t> vector_uint32_t;
typedef std::set<size_t> set_size_t;
typedef std::multiset<size_t> multiset_size_t;

typedef std::vector<string8_t> vector_string8_t;
typedef std::set<string8_t> set_string8_t;
typedef std::multiset<std::string> multiset_string8_t;

// Auxiliary functions definition
//
template<typename T> inline T Abs(const T a) { return a < 0 ? -a : a; }
template<typename T> inline T Min(const T a, const T b) {return a < b ? a : b;}
template<typename T> inline T Max(const T a, const T b) {return a > b ? a : b;}
template<typename T> inline void UpdateMin(T& a, const T b) {a = Min(a, b);}
template<typename T> inline void UpdateMax(T& a, const T b) {a = Max(a, b);}

static const double_t eps = 1.0e-09;
template<typename T> inline bool IsEqual(const T a, const T b) { return Abs(a - b) < eps; }
template<typename T> inline bool IsGreater(const T a, const T b) { return a > b + eps; }
template<typename T> inline bool IsLess(const T a, const T b) { return a + eps < b; }

template<typename T> inline string8_t ToStr(const T& val) { std::ostringstream ostr; ostr << val; return ostr.str(); }
template<typename T> inline bool FromStr(const string8_t& str, T& val) {std::istringstream istr(str); istr >> val; return !!istr; }

#if defined(ONLINE_JUDGE) || defined(__GNUC__)
template<size_t id> class StopWatch { };
#else //defined(ONLINE_JUDGE)
#include <library/lib_stopwatch.h>
#endif //defined(ONLINE_JUDGE)

static const uint64_t Mod = 1000000007;

template<typename T>
inline T FastPow(const T a, const T p, const T m)
{
    T res = 1;

    T mask = 1;
    T powPart = a;

    const size_t bitsCount = sizeof(T) * 8;
    for (size_t i = 0; i < bitsCount; i++)
    {
        if (p & mask)
        {
            res *= powPart;
            res %= m;
        }
        mask <<= 1;
        powPart *= powPart;
        powPart %= m;
    }

    return res;
}

template<typename T>
inline T ReverseElement(const T a)
{
    return FastPow(a, Mod-2, Mod);
}

uint64_t GetFactor(uint32_t k)
{
    if (k == 0)
        return 1;

    static const size_t ValuesCount = 256;
    static vector_uint32_t f(ValuesCount);

    if (f[k] != 0)
        return f[k];

    uint64_t r = 1;
    for (uint32_t i = 1; i <= k; i++)
    {
        r *= i;
        r %= Mod;
        f[i] = (uint32_t)r;
    }
    return (uint64_t)r;
}

uint64_t GetCombs(uint32_t kx, uint32_t ky)
{
    const uint64_t rev = ReverseElement((GetFactor(kx) * GetFactor(ky)) % Mod);
    return (GetFactor(kx + ky) * rev) % Mod;
}

void CalculateCount(uint32_t n, const vector_uint32_t& a, vector_uint32_t& ans)
{
    vector_uint32_t(n+1, 0).swap(ans);
    ans[0] = 1;
    for (size_t d = 0; d <= 9; d++)
    {
        vector_uint32_t next(n+1);

        for (uint32_t cnt = a[d]; cnt <= n; cnt++)
        {
            for (uint32_t p = cnt; p <= n; p++)
            {
                uint64_t delta = GetCombs((p - cnt), cnt);
                delta %= Mod;
                delta *= ans[p - cnt];
                delta %= Mod;
                next[p] += (uint32_t)delta;
                next[p] %= Mod;
            }
        }

        next.swap(ans);
    }
}

bool Solve(std::istream& ist, std::ostream& ost, const bool multipleTestMode)
{
    StopWatch<1> sw;
    uint32_t n;
    ist >> n;

    if (multipleTestMode && !ist)
    {
        return false;
    }

    vector_uint32_t a(10);
    for (size_t i = 0; i < a.size(); i++)
        ist >> a[i];

    uint64_t ans = 0;
    for (size_t first = 1; first <= 9; first++)
    {
        vector_uint32_t localAns;
        if (a[first] > 0)
        {
            a[first]--;
            CalculateCount(n-1, a, localAns);
            a[first]++;
        }
        else
        {
            CalculateCount(n-1, a, localAns);
        }

        for (uint32_t i = 0; i < n; i++)
        {
            ans += localAns[i];
            ans %= Mod;
        }
    }

    ost << (ans % Mod) << std::endl;

    return multipleTestMode;
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::istream& ist = std::cin;
    std::ostream& ost = std::cout;
#if defined(ONLINE_JUDGE)
    Solve(ist, ost, false);
#else
    while(Solve(ist, ost, true)) {};
#endif
}

/* Author : RISHAV GOYAL */

#include <bits/stdc++.h>

using namespace std;

#define LL long long int
#define UL unsigned long long int

#define imax INT_MAX
#define imin INT_MIN
#define LLmax LLONG_MAX
#define LLmin LLONG_MIN

#define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++)
#define rep(i,n) for(int i= int(1); i<= (int)n; i++)
#define FORd(i,a,b,d) for(int i=(int)a; i<= (int)b; i+=(int)d)

#define pr() printf("Reached here 1...\n");
#define pr1() printf("Reached here 2...\n");

#define CLR(a) memset(a,0,sizeof(a));
#define SET(a) memset(a,-1,sizeof(a));

#define str strlen
#define pb(x) push_back(x)
#define mp make_pair
#define ii pair<int,int>
#define gcd(a,b) __gcd(a,b)

#define mod int(1e9 +7)
#define MAX int(1e5 + 10)

#define si(a) scanf("%d",&a);

#define VI vector<int>
#define VL vector<LL>
#define VS vector<string>
#define VC vector<char>

LL powmod(LL a,int b,int n){LL rm=1;while (b){if (b % 2) { rm = (rm * a) % n; }a = (a * a) % n;b /= 2;}return rm;}

LL dp1[101][101]={0},dp[20][101]={0}, ncr[150][150]={0} ,invmod[110],invmod2[150], precomp[105][105];

int main()
{
	int n,a[110], t = 0;
	cin >> n;
	for (int i = 0; i < 10; ++i)
	{
		cin >> a[i];
		if(i) t += a[i];
	}

	for(int i=1;i<=102;++i){
		precomp[i][i] = i;
		for(int j=i+1;j<=102;++j){
			precomp[i][j] =  ( precomp[i][j-1] * j) % mod;
		}
	}

	LL denominator = 1;
	invmod[0] = powmod(1, mod - 2, mod);
	for(int i=1;i<=103;++i){
		denominator = (denominator * i ) % mod;
		invmod[i] = powmod(denominator, mod-2 , mod);
	}

	for(int i=1;i<=135;++i){
		invmod2[i] = powmod(i , mod-2, mod);
	}

	for(int i=a[1];i<=n;++i) dp[1][i] = 1 ;
	int sum = a[1];
	for(int i=2;i<=9;++i){
		for(int l=1;l<=n;++l){
			for(int j=a[i]; j<=l; ++j){

				if( l>j){
					// l-j, dp[l-j] * (l-j+1) * ... * (l) / j!
					LL v;
					if( j != 0){
						v = (dp[i-1][l-j] * precomp[l-j+1][l]) % mod;
						v = ( v * invmod[j] ) % mod;
					}
					else v = dp[i-1][l];

					dp[i][l] = (dp[i][l] + v) % mod ;
				}
				else if( l==j && !sum) dp[i][l] = (dp[i][l]+1) % mod;
			}
		}
		sum += a[i];
	}

	ncr[0][0] = 1 ;
	for(int i=1;i<=130;++i){
		ncr[i][0] = 1 ;
		for(int j=1;j<=i;++j){
			ncr[i][j] = ( ncr[i][j-1] * ( i - j + 1) ) % mod;
			ncr[i][j] = ( ncr[i][j] * invmod2[j] ) % mod;
		}
	}

	LL ways = 0;

	for(int LOVEFactor=1;LOVEFactor<=n;++LOVEFactor){

		for(int digits = 1; digits<=LOVEFactor; ++digits ){ // (zeros+digits-1) C (digits-1)
			int zeros = LOVEFactor - digits;
			if( zeros < a[0]) break;
			ways = (ways + (dp[9][digits] * ncr[zeros+digits-1][digits-1] ) % mod) % mod;
		}

	}

	cout << ways << endl;
	return 0;
}

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
using namespace std;

#define FOR0(i,n) for( i = 0 ; i < n ; i++ )
#define FOR1(i,n) for( i = 1 ; i <= n ; i++ )
#define sys_p system( "pause" )
#define End return 0
#define pb push_back
#define mp make_pair

typedef long long ll ;

ifstream Cin("input.txt");
ofstream Cout("output.txt");

typedef vector < int > vi ;
typedef vector < vi > vvi ;

vi a ;
vvi c ;
map < pair < ll, ll > , ll > dp ;
ll n, s ;

void solve( ll len, ll first )
{
          pair < ll , ll > cur = make_pair( len, first ) ;
          if( dp.count( cur ) > 0 )
            return ;
          ll i, ans = 0 ;
          if( first == 9 )
          {
              ans = ( a[9] <= len ) ;
          }
          else if( first == 0 )
          {
              for( i = a[0] ; i <= len ; i++ )
              {
                   solve( len-i, 1 ) ;
                   ans = ( ans + c[len-1][i] * dp[ make_pair( len-i, 1 ) ] ) % 1000000007 ;
              }
          }
          else
          {
              for( i = a[first] ; i <= len ; i++ )
              {
                   solve( len-i, first+1 );
                   ans = ( ans + c[len][i] * dp[ make_pair( len-i, first+1 ) ] ) % 1000000007 ;
              }
          }
          dp[cur] = ans ;
}

main()
{
      ll i, j, l, k, Ans = 0, Dp[101][10] = { } ;

      cin >> n ;

      c.resize( n+1, vi( n+1 ) ) ;
      FOR0( i, n+1 )
        c[i][0] = 1 ;
      FOR1( i, n )
        FOR1( j, i )
        {
          c[i][i] = 1 ;
          c[i][j] = ( c[i-1][j-1] + c[i-1][j] ) % 1000000007 ;
        }

      a.resize( 10 ) ;
      FOR0( i, 10 )
      {
        cin >> a[i] ;
        s += a[i] ;
      }

      /*
      for( i = s ; i <= n ; i++ )
      {
           solve( i, 0 );
           ans += dp[ make_pair( i, 0 ) ] ;
      }
      */

      for( i = 0 ; i <= n ; i++ )
      {
           for( j = 9 ; j >= 0 ; j-- )
           {
                ll ans = 0 ;
                if( j == 9 )
                {
                    ans = ( a[9] <= i ) ;
                }
                else if( j == 0 )
                {
                    if( i == 0 )
                    {
                        if( s == 0 )
                            ans = 1 ;
                        else
                            ans = 0 ;
                    }
                    else
                    {
                        for( l = a[0] ; l <= i ; l++ )
                        {
                             ans = ( ans + c[i-1][l] * Dp[ i-l ][ 1 ] ) % 1000000007 ;
                        }
                    }
                }
                else
                {
                    if( i == 0 )
                    {
                        ll sum = 0 ;
                        for( k = j ; k <= 9 ; k++ )
                            sum += a[k] ;
                        if( sum == 0 )
                            ans = 1 ;
                        else
                            ans = 0 ;
                    }
                    else
                    {
                         for( l = a[j] ; l <= i ; l++ )
                         {
                              ans = ( ans + c[i][l] * Dp[ i-l ][ j+1 ] ) % 1000000007 ;
                         }
                    }
                }
                Dp[i][j] = ans ;
           }

           if( i > 0 )
               Ans = ( Ans + Dp[ i ][ 0 ] ) % 1000000007 ;
      }

      cout << Ans ;

}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0, _##i = (n); i < _##i; ++i)
#define repi(i, a) for (__typeof((a).begin()) i = (a).begin(), _##i=(a).end(); i != _##i; ++i)

const int md = 1000000007;

void addmd(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}
void submd(int &a, int b) {
    a -= b;
    if (a < 0) a += md;
}
int multmd(int a, int b) {
    return (ll)a * b % md;
}

int bin[110][110];
int choose(int n, int k) {
    if (k < 0 || k > n) return 0;
    if (k == 0 || k == n) return 1;
    if (n == 0) return 1;
    int &res = bin[n][k];
    if (~res) return res;
    res = choose(n - 1, k - 1);
    addmd(res, choose(n - 1, k));
    return res;
}

int dp[110][11];
int need[10];
int getdp(int n, int i) {
    if (i == 10) return n == 0;
    int &res = dp[n][i];
    if (~res) return res;
    res = 0;
    rep (j, n + 1) {
        if (j >= need[i]) {
            addmd(res, multmd(getdp(n - j, i + 1), choose(n, j)));
        }
    }
    return res;
}

int main() {
//  freopen("a.in","r",stdin); freopen("a.out","w",stdout);
    memset(bin, -1, sizeof(bin));
    int n;
    cin >> n;
    rep (i, 10) cin >> need[i];
    memset(dp, -1, sizeof(dp));
    int t = 0;
    rep (i, n) {
        addmd(t, getdp(i + 1, 0));
    }
    memset(dp, -1, sizeof(dp));
    need[0]--;
    rep (i, n) {
        submd(t, getdp(i, 0));
    }
    cout << t;
}

#include<bits/stdc++.h>
typedef long long ll;
#define M 1000000007
#define endl "\n"
#define rep(a,b,in) for(int i=a;i<b;i+=in)
#define int long long
using namespace std;
int fact[105];
ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
ll InverseEuler(ll n, ll MOD)
{
    return poww(n, MOD - 2, MOD);
}

ll C(ll n, ll r, ll MOD)
{

    return (fact[n] * ((InverseEuler(fact[r], MOD) * InverseEuler(fact[n - r], MOD)) % MOD)) % MOD;
}

int a[15];
int n;

int dp[15][105];
int rec(int ind,int left)
{
	if(ind==10)
	{
		if(left==0)
		{
			return 1;
		}
		return 0;
	}
	if(dp[ind][left]>=0)
	{
		return dp[ind][left];
	}
	if(a[ind]>left)
	{
		return 0;
	}
	if(ind==0)
	{
		int ans=0;
		for(int i=max(a[ind],1ll);i<=left;i++)
		{
			ans+=(((C(left,i,M)-C(left-1,i-1,M)+M)%M)*rec(ind+1,left-i))%M;
			ans%=M;
		}
		if(a[ind]==0)
		{
			ans+=rec(ind+1,left);
			ans%=M;
		}
		dp[ind][left]=ans;
		return ans;
	}
	int ans=0;
	for(int i=a[ind];i<=left;i++)
	{
		ans+=(C(left,i,M)*rec(ind+1,left-i))%M;
		ans%=M;
	}
	dp[ind][left]=ans;
	return ans;
}
int32_t main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    memset(dp,-1,sizeof(dp));
   	fact[0]=1;
   	for(int i=1;i<105;i++)
   	{
   		fact[i]=(fact[i-1]*i)%M;
   	}
    cin>>n;
    for(int i=0;i<10;i++)
    {
    	cin>>a[i];
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
    	ans+=rec(0,i);
    	ans%=M;
    }
    cout<<ans;
}

#pragma comment(linker, "/STACK:256000000")

#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>

using namespace std;

template<class T>
double sqrt(T x)
{
    return sqrt((double) x);
}

template<class T>
T sqr (T x)
{
    return x*x;
}

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
//#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
const int M = INF;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef double D;
typedef vector<int> vi;

//#define ONLINE_JUDGE

int C[1100][1100];

int memo[10][105];

int main()
{
    double TIME_START = clock();

#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#else
    //freopen("INPUT.TXT","r",stdin);
    //freopen("OUTPUT.TXT","w",stdout);
#endif

	C[0][0] = 1;
	for (int i = 1 ; i < 1100 ; i++)
	{
		C[i][0] = C[i][i] = 1;
		for (int j = 1 ; j < i ; j++)
			C[i][j] = (C[i-1][j] + C[i-1][j-1])%MOD;
	}

	int n;
	cin >> n;
	int a[10];
	for (int i = 0 ; i < 10 ; i++) cin >> a[i];

	for (int i = a[9] ; i <= n ; i++ ) memo[9][i] = 1;
	for (int i = 8; i >= 0 ; i-- )
	{
		for (int j = a[i] ; j <= n ; j++)
			for (int k = 0; j + k <= n ; k++)
				memo[i][j+k] = (memo[i][j+k] + (1ll*memo[i+1][k]*C[j+k-((i)?(0):(1)) ][j])%MOD)%MOD;
	}

	int ans = 0;
	for (int i = 1 ; i  <= n ; i++)
	{
		ans += memo[0][i];
		ans %= MOD;
	}

	cout<<ans;

    eprintf("\n\n%.15lf\n\n",(double)(clock() - TIME_START)/CLOCKS_PER_SEC);
    return 0;
}

/*

    FILE *fILE = fopen("INPUT.TXT", "r");
    if ( fILE )
    {
        fclose(fILE);
        freopen("INPUT.TXT","r",stdin);
        freopen("OUTPUT.TXT","w",stdout);
    } else
    {
        freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    }

*/

//solution by Wsl_F
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <cassert>
#include <time.h>
#include <ctime>
#include <memory.h>
#include <complex>
#include <utility>
#include <climits>
#include <cctype>
#include <x86intrin.h>

using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")

typedef long long LL;
typedef unsigned long long uLL;
typedef double dbl;
typedef vector<int> vi;
typedef vector<LL> vL;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;

#define mp(x,y)  make_pair((x),(y))
#define pb(x)  push_back(x)
#define sqr(x) ((x)*(x))

const LL mod= 1000*1000*1000+7;

LL C[111][111];
LL a[11];
LL dp[111][11];

int main()
{
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 srand(__rdtsc());
 // LL a[110];
 // memset(a,0,sizeof(a));

 //freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 //cout<<fixed;
 //cout<<setprecision(9);
 int n;
 cin>>n;
 for (int i=0; i<10; i++)
    cin>>a[i];

 for (int i=0; i<=n; i++)
    for (int j=0; j<=i; j++)
        if(i==j || j==0) C[i][j]=1;
        else C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;

 for (int len=0; len<=n; len++)
 {
     if (len>=a[9]) dp[len][9]= 1;
     else dp[len][9]= 0;
     for (int j= 8; j>0; j--)
        for (int i=a[j]; i<=len; i++)
        {
            dp[len][j]+= dp[len-i][j+1]*C[len][i];
            dp[len][j]%= mod;
        }
     for (int i= a[0]; i<=len; i++)
     {
        dp[len][0]+= dp[len-i][1]*C[len-1][i];
        dp[len][0]%= mod;
     }

 }

/*
 for (int len= 0; len<=n; len++)
 {
     for(int j=0; j<10; j++)
        cout<<dp[len][j]<<" ";
     cout<<endl;
 }
*/

 LL ans= 0;
 for (int i=1; i<=n; i++)
    ans= (ans+dp[i][0])%mod;

 ans%= mod;
 ans+= mod;
 ans%= mod;
 cout<<ans<<endl;
 return 0;
}

// Author : JayYe  Created Time: 2013-11-9 20:29:54
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
typedef __int64 ll;

const int maxn = 100 + 10;
const int mod = 1000000007;

ll fac[maxn], dp[12][maxn], ff[maxn];
int cnt[maxn];

ll exgcd(ll a, ll b, ll &x, ll &y) {
    if(!b) {
        x = 1; y = 0;
        return a;
    }
    ll ret = exgcd(b, a%b, y, x);
    y -= a/b*x;
    return ret;
}

ll inv(ll a, ll mod) {
    ll x, y, d = exgcd(a, mod, x, y);
    if(x < 0)   x += mod;
    return x;
}

void init(int n) {
    fac[0] = ff[0] = 1;
    for(int i = 1;i <= n; i++)  fac[i] = fac[i-1]*i%mod;
    for(int i = 1;i <= n; i++)
        ff[i] = inv(fac[i], mod);
}

ll cal(int n, int tot) {
    for(int i = 0;i < 10; i++)
        for(int j = 0;j <= n; j++)
            dp[i][j] = 0;
    for(int i = cnt[0];i <= n; i++) dp[0][i] = ff[i];
    for(int i = 1;i < 10; i++) {
        for(int j = cnt[i];j <= n; j++) {
            for(int k = 0;k <= n-j; k++) if(dp[i-1][k]) {
                dp[i][j+k] = (dp[i][j+k] + dp[i-1][k]*ff[j]%mod)%mod;
            }
        }
    }
    ll ret = 0;
    for(int i = 1;i <= n; i++) {
        ret = ret + dp[9][i]*fac[i]%mod;
        ret %= mod;
    }
    return ret%mod;
}

int main() {
    init(100);
    int n;
    scanf("%d", &n);
    int tot = 0;
    for(int i = 0;i < 10; i++) {
        scanf("%d", &cnt[i]);
        tot += cnt[i];
    }
    if(tot > n) return puts("0"), 0;

    ll ans = cal(n, tot);
    if(!tot)    ans--;
    if(cnt[0]) {
        cnt[0]--;
        ans -= cal(n-1, tot-1);
    }
    else {
        ans -= cal(n-1, tot);
    }
    printf("%I64d\n", (ans%mod + mod)%mod);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
ll a[10],dp[10][105],c[105][105],hell=pow(10,9)+7;
ll add(ll a,ll b){
  a+=b;
  if(a>hell)
    a-=hell;
  return a;
}
void solve(){
  ll n,sum=0;
  cin>>n;
  c[0][0]=1;
  for(ll i=1;i<=n;i++){
    c[i][0]=c[i][i]=1;
    for(ll j=1;j<i;j++)
      c[i][j]=add(c[i-1][j],c[i-1][j-1]);
  }
  for(ll i=0;i<10;i++)
    cin>>a[i];
  for(ll i=a[9];i<=n;i++)
    dp[9][i]=1;
  for(ll i=8;i>=0;i--){
    sum+=a[i];
    for(ll j=sum;j<=n;j++)
      for(ll k=a[i];k<=(i==0?j-1:j);k++)
        dp[i][j]=add(dp[i][j],(dp[i+1][j-k]*c[(i==0?j-1:j)][k])%hell);
    //cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<" "<<dp[i][3]<<endl;
  }
  ll res=0;
  for(ll i=sum;i<=n;i++)
    res=add(res,dp[0][i]);
  cout<<res;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll q=1;
  for(ll i=0;i<q;i++)
    solve();
}

#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define y1 asdgh
#define int long long
#define double long double
#define endl '\n'
//mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
//#pragma warning(disable:4996)
//#pragma comment(linker, "/STACK:336777216")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*------------------------------<Debugging Stuff>---------------------------------*/

template<class L, class R> ostream& operator<<(ostream &os, pair<L , R> P) {
      return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R , class M> ostream& operator<<(ostream &os, tuple<L , R , M> P) {
      return os << "(" << get<0>(P) << "," << get<1>(P) << "," << get<2>(P) << ")";
}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
      os << "{ "; for(auto v : V) os << v << " "; return os << "}";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*------------------------------</Debugging Stuff>--------------------------------*/
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int) 1e18 + 18;
const int mod = (int) 1e9 + 7;
int n , a[10] , dp[200][10];
int fac[maxn] , ifac[maxn];

inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1LL * y) % mod;}
inline int binpow(int a, int b){
      int x = 1 % mod;
      while(b){
            if(b & 1) x = mul(x, a);
            a = mul(a, a);
            b >>= 1;
      }
      return x;
}
inline int inv(int a){ return binpow(a, mod - 2);}

signed main() {

      fio;
      cin >> n;
      for(int i = 0; i < 10; i++) cin >> a[i];
      fac[0] = 1 , ifac[0] = 1;
      for(int i = 1; i <= 200; i++){
            fac[i] = mul(fac[i - 1] , i);
            ifac[i] = inv(fac[i]);
      }
      int ans = 0;
      for(int digits = a[9]; digits <= n; digits++) dp[digits][9] = 1;
      for(int use = 8; use >= 0; use--){
            for(int digits = 0; digits <= n; digits++){
                  for(int i = a[use]; i <= digits; i++){
                        if(use){
                              int ad = mul(dp[digits - i][use + 1] , fac[digits]);
                              ad = mul(ad , mul(ifac[i] , ifac[digits - i]));
                              dp[digits][use] = add(dp[digits][use] , ad);

                        } else {
                              if(i == digits) continue;
                              int ad = mul(dp[digits - i][use + 1] , fac[digits - 1]);
                              ad = mul(ad , mul(ifac[i] , ifac[digits - i - 1]));
                              dp[digits][use] = add(dp[digits][use] , ad);
                        }
                  }
            }
      }

      for(int digits = 1; digits <= n; digits++){
            ans = add(ans , dp[digits][0]);
      }

      cout << ans << endl;

      return 0;
}

// IMPORTANT -:
// partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) a[0] , a[1] + a[0] ,......
// adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) - a[0] , a[1] - a[0] ,......
// check base cases n = 0 , n = 1
// max / min questions - check for binary search
// difference array might be interesting

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll ncr[105][105],a[10],dp[105][10];
void init(){
    for(ll i=0;i<105;i++){
        ncr[i][0]=1;
        for(ll j=1;j<=i;j++)ncr[i][j]=ncr[i-1][j]+ncr[i-1][j-1],ncr[i][j]%=mod;
    }
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    init();
    ll n;cin>>n;
    for(ll i=0;i<10;i++)cin>>a[i];
    for(ll len=a[9];len<=n;len++)dp[len][9]=1;
    for(ll dig=8;dig>=1;dig--){
        for(ll len=0;len<=n;len++){
            for(ll take=a[dig];take<=n;take++){
                if(len>=take){
                    dp[len][dig]+=dp[len-take][dig+1]*ncr[len][take]%mod,dp[len][dig]%=mod;
                }
            }
        }
    }
    for(ll len=0;len<=n;len++){
        for(ll take=a[0];take<=n;take++){
            if(len>take){
                dp[len][0]+=dp[len-take][1]*ncr[len-1][take],dp[len][0]%=mod;
            }
        }
    }
    ll ans = 0;
    for(ll len=0;len<=n;len++)ans+=dp[len][0],ans%=mod;
    cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and
// everything else after looking at this

const ll MAXN = 205;
const ll MOD = 1e9+7;

ll fact[MAXN],invfact[MAXN];

ll power(ll x,ll y){
    ll ret = 1;
    while(y){
        if(y&1) ret = (ret*x)%MOD;
        y >>= 1;
        x = (x*x)%MOD;
    }
    return ret;
}

ll modinv(ll k){
    return power(k,MOD-2);
}

void precompute(){
    fact[0] = fact[1] = 1;
    FOR(i,2,MAXN-1){
        fact[i] = (fact[i-1]*i)%MOD;
    }
    invfact[MAXN-1] = modinv(fact[MAXN-1]);
    RFOR(i,0,MAXN-2){
        invfact[i] = (invfact[i+1]*(i+1))%MOD;
    }
}

ll nCr(ll x,ll y){
    if(y > x) return 0;
    ll num = fact[x];
    num = (num*invfact[y])%MOD;
    num = (num*invfact[x-y])%MOD;
    return num;
}

ll n,sum = 0;
ll dp[10][MAXN],a[MAXN];

ll recursion(ll dig,ll len){
    if(dig == 1){
        if(len < a[1]) return 0;
        return 1;
    }

    if(dp[dig][len] != -1) return dp[dig][len];

    ll ans = 0;

    FOR(i,a[dig],len){
        ll cur = (nCr(len,i)*recursion(dig-1,len-i))%MOD;
        ans = (ans + cur)%MOD;
    }
    return dp[dig][len] = ans;
}

void solve(){
    memset(dp,-1,sizeof(dp));
    precompute();

    cin>>n;
    FOR(i,0,9){
        cin>>a[i];
        sum += a[i];
    }

    ll ans = 0;
    FOR(len,sum,n){
        FOR(zeroes,a[0],len){
            ans = (ans + nCr(len-1,zeroes)*recursion(9,len-zeroes))%MOD;
        }
    }
    cout<<ans<<endl;
}

signed main(){

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    FastRead;

    ll t;
    t = 1;
    // cin>>t;

    while(t--) solve();

}

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <set>

using namespace std;

const int MOD = 1000000007;

int n;
int d[10];
long long dp[105];
long long odp[105];
long long c[105][105];

int main() {
    cin >> n;
    for (int i = 0; i < 10; ++i) cin >> d[i];
    c[0][0] = 1;
    for (int a = 1; a <= 100; ++a)
        for (int b = 0; b <= 100; ++b) {
            if (b == 0) c[a][b] = 1;
            else c[a][b] = (c[a - 1][b] + c[a - 1][b - 1]) % MOD;
        }
    memset(odp, 0, sizeof(odp));
    odp[0] = 1;
    for (int tdig = 1; tdig <= 10; ++tdig) {
        int dig = tdig % 10;
        memset(dp, 0, sizeof(dp));
        for (int len = 0; len <= n; ++len) {
            for (int cnt = d[dig]; cnt + len <= n; ++cnt) {
                if (dig == 0) {
                    dp[len + cnt] += odp[len] * c[len + cnt - 1][cnt];
                    dp[len + cnt] %= MOD;
                } else {
                    dp[len + cnt] += odp[len] * c[len + cnt][cnt];
                    dp[len + cnt] %= MOD;
                }
            }
        }
        for (int i = 0; i <= n; ++i) odp[i] = dp[i];
    }
    int res = 0;
    for (int i = 1; i <= n; ++i) {
        res += dp[i];
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}

#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <cstdio>
#include <math.h>
#include <time.h>
#include <iomanip>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;

#define LL long long
#define MIN INT_MIN
#define MAX (1<<30)
#define pii pair<int,int>
#define bug cout<<"here!!!"<<endl
#define FRE freopen("input.txt","r",stdin)
#define FF freopen("output.txt","w",stdout)
#define eps 1e-10
#define pi 3.141
#define N 105
#define mod 1000000007
LL f[11][111];
int a[111];
LL c[111][111];
int main(){
    int n;
    cin>>n;
    int i,j,k;
    c[0][0] = 1;
    for(i=1;i<=n;i++){
        c[i][0] = c[i][i] = 1;
        for(j=1;j<i;j++){
            c[i][j] = (c[i-1][j-1]+c[i-1][j])%mod;
        }
    }
    for(i=0;i<10;i++)cin>>a[i];
    memset(f,0,sizeof(f));
    for(i=a[9];i<=n;i++){
        f[9][i] = 1;
    }
    for(i=8;i>=0;i--){
        for(j=a[i];j<=n;j++){
            for(k=0;k<=n;k++){
                if(j+k<=n){
                    if(i){
                        f[i][j+k] = (f[i][j+k] + f[i+1][k]*c[j+k][j])%mod;
                    } else {
                        f[i][j+k] = (f[i][j+k] + f[i+1][k]*c[j+k-1][j])%mod;
                    }
                }
            }
        }
    }
    LL ans = 0;
    for(i=1;i<=n;i++){
        ans = (ans+f[0][i])%mod;
    }
    cout<<ans<<endl;
    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long int
#define pb push_back
#define mod 1000000007
#define inarr(i,arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(i,arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<' ';
#define swap(a,b,t) {t=a;a=b;b=t;}
#define ve vector
#define sz(a) (int)((a).size())
#define fi first
#define se second
#define pa pair
#define fastio  {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
#define ll long long int
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define frn(i, a, b) for (int i = a; i >= b; i--)
#define mk make_pair
#define endl "\n"
#define setvector(i, vname,value,size); for(int i=0;i<size;i++)vname[i]=value;
const ll inf = 9e18;
//uncomment for accurate decimal precision.
//cout << fixed << setprecision(9);
ve <ll> fac(103);
ll fast_expo(ll a, ll n)
{
	int ans=1;
	while(n>0)
	{
		if(n%2==1)
			ans=(ans*a)%mod;
		a=(a*a)%mod;
		n=n/2;
	}
	return ans;
}
ll n_c_r_mod_m(ll n, ll r)
{
    ll ans= ((fac[n]*fast_expo(fac[r],mod-2))%mod);
    ans=((ans*fast_expo(fac[n-r],mod-2))%mod);
    return ans;
}
int main()
{
    //fastio
    fac[0]=1;
    fr(i, 1, 102)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
    }
    ll n;
    cin>>n;
    ve <ll> a(10)
    inarr(i, a, 10);
    ve <ve <ll>> dp(n+1, ve <ll>(10,0));
    ve <ve <ll>> dp1(n+1, ve <ll>(10,0));
    ll sum=0;
    fr(i, 0, 9)
    {
        sum+=a[i];
    }
    if(n<sum)
    {
        cout<<0<<endl;
        return 0;
    }
    ll _t=0;
    while((_t<10))
    {
        if(a[_t])
            break;
        dp[0][_t]=1;
        _t++;
    }
    fr(len, 1, n)
    {
        if(len>=a[0])
            dp[len][0]=1;
        fr(j, 1, 9)
        {
            frn(k, len-a[j], 0)
            {
                dp[len][j]+=dp[k][j-1]*n_c_r_mod_m(len, k);
                dp[len][j]%=mod;
            }
        }
    }
    if(a[0])
    {
        a[0]--;
    }
        _t=0;
        while((_t<10))
        {
            if(a[_t])
                break;
            dp1[0][_t]=1;
            _t++;
        }
        fr(len, 1, n)
        {
            if(len>=a[0])
                dp1[len][0]=1;
            fr(j, 1, 9)
            {
                frn(k, len-a[j], 0)
                {
                    dp1[len][j]+=dp1[k][j-1]*n_c_r_mod_m(len, k);
                    dp1[len][j]%=mod;
                }
            }
        }
    ll ans=0;
    fr(i, sum, n)
    {
        ans+=(dp[i][9]-(i>0?dp1[i-1][9]:1));
        ans+=mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    //*/
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

#define LL          long long int
#define ULL         unsigned long long
#define lc          idx * 2
#define rc          lc | 1
#define pb          push_back
#define pf          push_front
#define S           second
#define F           first
#define mp          make_pair
#define ios         ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);   // always use FI/scanf if N >= ~5e5
#define si(x)       scanf("%d", &x);
#define sll(x)      scanf("%lld", &x);
#define pi(x)       printf("%d", x);
#define pll(x)      printf("%lld", x);
#define sp          printf(" ");
#define nl          printf("\n");

#define dbg(x)          cerr << #x << " : " << x << endl;
#define dbg2(x, y)      cerr << #x << " : " << x << " " << #y << " : " << y << endl;
#define dbg3(x, y, z)   cerr << #x << " : " << x << " " << #y << " : " << y << " " << #z << " : " << z << endl;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;

const LL  INF = 1600000000000000000LL;   // 1.6 * 10^18
const int MOD = 1000000007;              // 1e9 + 7
double eps = 0.0000000001;

LL fpow(LL a,LL b,LL mo=MOD){LL res=1;a%=mo; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
inline LL inv(LL a) {return fpow(a, MOD-2, MOD);}

//cout << fixed << setprecision(8);

/*
    int start_s=clock();
    // the code you wish to time goes here
    int stop_s=clock();
    cout << "time: " << (stop_s-start_s)/double(CLOCKS_PER_SEC) << endl;
*/

const int dx8[] = {1, 1, 0, -1, -1, -1, 0,1};
const int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx4[] = {0, 0, 1, -1};
const int dy4[] = {1, -1, 0, 0};

const int N = 111;

LL dp[N][N];

int n;
int a[122];

LL C[N][N];

void init()
{
    for(int i = 0; i < N; i++)C[0][0] = 1;
    for(int i = 1; i < N; i++)
    {
        C[i][0] = 1;
        C[i][1] = i;
        for(int j = 2; j <= i; j++)
        {
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
        }
    }
}

LL solve(LL len, int num)
{
   // cout << len << " " << num << " " << a[num] << endl;
    //if(a[num] > len)return 0;
    if(num == 1 and a[1] <= len)return 1;

    LL &ret = dp[len][num];
    if(ret > -1)return ret;

    ret = 0;
   // cout << len << " " << num << " " << a[num] << endl;
    for(int i = a[num]; i <= len; i++)
    {
        ret = (ret + (solve(len - i, num - 1) * 1LL * C[len][i])) % MOD;
    }

    //cout << len << " " << num << " " << ret << endl;

    return ret;
}

int main()
{
    init();

    int n;
    cin >> n;

    LL s = 0;
    for(int i = 0; i < 10; i++){cin >> a[i]; s += a[i];}

    LL ans = 0;
    for(int j = 0; j < N; j++)for(int k = 0; k < N; k++)dp[j][k] = -1;
    for(int i = s; i <= n; i++)
    {
        //
        for(int j = a[0]; j <= i - 1; j++)
        {
            //map<int, int> m;
            //m.insert({1, 2});
           // dbg(m);
            ans = (ans + (solve(i - j, 9) * 1LL * C[i - 1][j]) % MOD) % MOD;
           // cout << endl;
        }
    }

    cout << ans;
}

//atyaki3794
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <climits>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <cassert>
#include <bitset>
#include <iomanip>
#define gc getchar_unlocked
#define pc putchar_unlocked
#define PI (3.14159265)
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define INF (100000005)
#define SIZE (2)
#define TREESIZE (302144)
#define LEFT(n) (2*n)
#define RIGHT(n) (2*n+1)
#define epsilon 1e-8 //add to double before casting to integer

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> ii;
typedef pair<ii, int> iii;

// #define matrix vector<vector<ll> >
// matrix identity;
// matrix matmul(const matrix &a,const matrix &b)
// {
//   int n=a.size();
//   matrix ans(n,vector<ll> (n, 0) );
//   for (int i = 0; i < n; ++i)
//   {
//     for (int j = 0; j < n; ++j)
//     {
//       for (int k = 0; k < n; ++k)
//       {
//         ans[i][j] += (a[i][k]*b[k][j])%MOD;
//         ans[i][j] %= MOD;
//       }
//     }
//   }
//   return ans;
// }

// matrix matpwr(const matrix &a,long long n)
// {
//     if(n==0)
//     {
//       return identity;
//     }
//     if(n==1)
//      return a;
//     matrix tmp=matpwr(a,n/2);
//     tmp=matmul(tmp,tmp);
//     if(n&1)
//       tmp=matmul(a,tmp);
//     return tmp;
// }

ll pwr(ll base, ll p, ll mod = MOD){
    ll ans = 1;
    while(p){
        if(p & 1)   ans = (ans * base) % mod;
        base = (base * base) % mod;
        p /= 2;
    }
    return ans;
}

ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b){
    return (a*b) / gcd(a, b);
}

ll invMod(ll n){
    return pwr(n, MOD-2);
}

int n, arr[11], ps[11];
ll DP[105][12], ncr[105][105], fac[105];

ll dp(int n, int i){

    if(n < arr[i])  return 0;
    if(DP[n][i] != -1)  return DP[n][i];

    if(i == 1)
        return DP[n][i] = 1;

    ll ans = 0;
    for(int j=arr[i];j<=n;j++){

        ll temp = (dp(n-j, i-1) * ncr[n][j]) % MOD;
        ans = (ans + temp) % MOD;
    }

    return DP[n][i] = ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    // freopen("input.txt", "r", stdin);

    cin>>n;
    for(int i=0;i<10;i++)   cin>>arr[i];

    ps[1] = arr[1];
    for(int i=2;i<10;i++)   ps[i] = ps[i-1] + arr[i];

    fac[0] = 1;
    for(int i=1;i<=100;i++)
        fac[i] = (fac[i-1] * i) % MOD;

    ncr[0][0] = 1;
    for(int i=1;i<=100;i++){

        ncr[i][0] = 1;
        for(int j=1;j<=i;j++)
            ncr[i][j] = (ncr[i-1][j] + ncr[i-1][j-1]) % MOD;
    }

    memset(DP, -1, sizeof(DP));
    int minlen = ps[9]+arr[0];

    ll ans = 0;
    for(int len=minlen;len<=n;len++)
        for(int c0=arr[0];c0<=len-1;c0++){

            ll temp = (dp(len-c0, 9) * ncr[len-1][c0]) % MOD;
            ans = (ans + temp) % MOD;
        }

    cout<<ans;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#define mo 1000000007
using namespace std;
typedef long long LL;
LL a[10],n,c[101][101],dp[11][101];

LL Dp()
{
	dp[10][0]=1;
	for (int i=9;i>=0;i--)
		for (int j=n;j>=0;j--)
			for (int k=j-a[i];k>=0;k--)
				if (i) dp[i][j]=(dp[i][j]+dp[i+1][k]*c[j][k])%mo; else
				if (j&&k)dp[i][j]=(dp[i][j]+dp[i+1][k]*c[j-1][k-1])%mo;
	LL ans=0;
	for (int i=0;i<=n;i++)
		ans+=dp[0][i],ans%=mo;
	return ans;
}

int main()
{
	cin>>n;
	for (int i=0;i<10;i++)
		cin>>a[i];
	for (int i=0;i<=n;i++)
	{
		c[i][0]=c[i][i]=1;
		for (int j=1;j<i;j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mo;
	}
	cout<<Dp()<<endl;
	return 0;
}

/*
ID: Tariqul
PROG:
LANG: C++
*/

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 105;
const int Mod = 1000000007;
int f[maxn][15],C[maxn][maxn];
int A[maxn];

int memo(int len,int d)
{
	int &res = f[len][d]; if(res != -1)return res;
	if(d == 10)return res = (len == 0); res = 0; int i; Long val;
	fo(i,A[d],len+1)
	{
		if(d == 0)val = C[len-1][i];
		else val = C[len][i];
		val *= memo(len - i,d+1); val %= Mod;
		res += (int)val; res %= Mod;
	}
	return res;
}

int main()
{
	#ifdef localhost
	freopen("D://input.txt","r",stdin);
	//freopen("D://output.txt","w",stdout);
	#endif

	int i,j,n; cin >> n; fo(i,0,10)cin >> A[i]; CLR(f,-1); int res = 0;
	fo(i,0,maxn)C[i][i] = C[i][0] = 1;
	fo(i,2,maxn)fo(j,1,i)C[i][j] = (C[i-1][j-1] + C[i-1][j] ) %Mod;

	fo(i,1,n+1){ res += memo(i,0); res %= Mod; }
	cout << res;
	printf("\n");
	return 0;
}

/*
 * DNumbers.cpp
 *
 *  Created on: Nov 17, 2012
 *      Author: piotrek
 */

#include<iostream>
#include<set>
#include<vector>
#include<map>

using namespace std;

const long long int MOD = 1000000007;
long long int res[10][103];
long long int a[10];

long long int newton[105][105];

void comptNewton() {
  for (int n = 0; n < 103; n++) {
    newton[n][0] = 1;
    newton[n][n] = 1;
  }

  for (int n = 1; n < 103; n++) {
    for (int k = 1; k < n; k++) {
      newton[n][k] = (newton[n-1][k-1] + newton[n-1][k]) % MOD;
    }
  }

//  for (int n = 0; n < 8; n++) {
//    for (int k = 0; k <= n; k++) {
//      cout << newton[n][k] << " ";
//    }
//    cout << endl;
//  }
}

int main() {
  ios_base::sync_with_stdio(0);

  comptNewton();

  int n;
  cin >> n;
  for (int i = 0; i < 10; i++) {
    cin >> a[i];
  }

  for (int i = 0; i < 10; i++) {
    for (int k = 0; k < 103; k++) {
      res[i][k] = 0;
    }
  }

  int s = a[9];

  for (int k = s; k <= n; k++) {
    res[9][k] = 1;
  }

  for (int i = 8; i > 0; i--) {
    s += a[i];  // s - liczb zadanych cyfr
    for (int k = s; k <= n; k++) { // k - dlugosc liczby
      for (int additional = 0; additional + s <= k; additional++) { // additional -dodatkowe cyfry
        res[i][k] += newton[k][additional+a[i]]*res[i+1][k-additional-a[i]] % MOD;
        res[i][k] %= MOD;
      }
    }
  }

  s += a[0];
  for (int k = s; k <= n; k++) { // k - dlugosc liczby
    for (int additional = 0; additional + s <= k; additional++) { // additional -dodatkowe cyfry
      res[0][k] += newton[k-1][additional+a[0]]*res[1][k-additional-a[0]] % MOD;
      res[0][k] %= MOD;
    }
  }

  long long int r = 0;

  for (int i = 1; i <= n; i++) {
    r += res[0][i];
    r %= MOD;
  }

  cout << r << endl;

  return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<bitset>
#include<iomanip>
#include<iostream>
#include<cmath>
using namespace std;
#define rep(i,x,y) for(i=x;i<=y;i++)
#define _rep(i,x,y) for(i=x;i>=y;i--)
#define REP(i,x,y) for(int i=(x);i<=(y);i++)
#define _REP(i,x,y) for(int i=(x);i>=(y);i--)
#define CL(S,x) memset(S,x,sizeof(S))
#define CP(S1,S2) memcpy(S1,S2,sizeof(S2))
#define ALL(x,S) for(x=S.begin();x!=S.end();x++)
#define pb push_back
#define IN insert
#define ER erase
#define BE begin()
#define ED end()
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define fi first
#define se second
#define upmin(x,y) x=min(x,y)
#define upmax(x,y) x=max(x,y)
#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl
template<class T> inline void read(T&x){bool fu=0;char c;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x=-x;};
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z){read(x);read(y);read(z);}
inline char getc(){char c;for(c=getchar();c<=32;c=getchar());return c;}

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const ll mod=ll(1e9)+7;
int n,i,j,k,l,l2,a[10],tot;
ll C[210][210];
ll f[20][210];

#define up(x,y) x=((x)+(y))%mod
int main()
{
    //freopen("1.in","r",stdin);freopen("1.out","w",stdout);
    read(n);rep(i,0,9)read(a[i]);
    rep(i,1,9)tot+=a[i];

    rep(i,0,200){C[i][0]=1;rep(j,1,i)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;}

    f[0][0]=1;
    rep(i,1,9)
    rep(j,0,n)if(f[i-1][j])
    rep(k,a[i],n)
    up(f[i][j+k],f[i-1][j]*C[j+k][k]);

    ll ans=0;
    rep(i,a[0],n-1)
    {
        ll res=0;
        rep(j,1,n-i)
        up(res,f[9][j]*C[j+i-1][i]);
        up(ans,res);
    }
    cout<<ans<<endl;
    scanf("\n");
    return 0;
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <sstream>

//#pragma comment(linker, "/STACK:167772160")
using namespace std;

#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define sz(s) (int)s.size()
#define pb push_back
#define mp make_pair
#define y1 kfjad
#define y0 fkasj
typedef long long Int;
const int inf=1000000000;
const double pi=2*acos(0.0);
const int MOD=1000000007;

int C[111][111];
int dp[22][111],a[11];

int main()
{
   //freopen("input.txt","r",stdin);
   FOR(i,0,100)
    FOR(j,0,i)
    if(i==j || j==0)C[i][j]=1;else C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

   int n;
   cin>>n;
   FOR(i,0,9)cin>>a[i];
   int ans=0;
   FOR(len,1,n)
   {
       memset(dp,0,sizeof(dp));
       dp[0][0]=1;
       FOR(i,0,9)
       {
           FOR(c,0,len)
               FOR(cnt,a[i],len)
               if(c+cnt<=len)
               {
                   int g;
                   if(i==0 && len==c)g=0;else
                   if(i==0)g=C[len-c-1][cnt];else
                       g=C[len-c][cnt];
                    dp[i+1][c+cnt]=(dp[i+1][c+cnt]+(Int)g*dp[i][c])%MOD;
               }
       }
       ans=(ans+dp[10][len])%MOD;
   }
   cout<<ans<<endl;
}

/*

ID: jbsu321
PROG: test
LANG: C++

*/

#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <list>
#include <bitset>
#include <ctime>

#define ms(a,b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define pi (2*acos(0))
#define oo 1<<29
#define dd double
#define ll long long
#define ff float
#define MP make_pair
#define EPS 10E-10
#define fr first
#define sc second
#define MAXX 100
#define SZ(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define intlim 2147483648
#define rtintlim 46340
#define llim 9223372036854775808
#define rtllim 3037000499
#define pall pair<ll,ll>
#define padd pair<dd,dd>
#define paii pair<int,int>
#define ull unsigned long long
#define csprint printf("Case %lld: ", C++)
#define bpc __builtin_popcount

#define REP(i,N)  for(i=0;i<N;i++)
#define REV(i,N)  for(i=N;i>=0;i--)
#define FOR(i,p,k) for (i=p; i<k;i++)

#define ISS         istringstream
#define OSS         ostringstream
#define VS          vector<string>
#define vi          vector<int>
#define vd          vector<double>
#define vll         vector<long long>
#define SII         set<int>::iterator
#define SI          set<int>
#define mem(a,b)    memset(a,b,sizeof(a))
#define fs          first
#define sc          second
#define pii         pair < int , int >

#define EQ(a,b)     (fabs(a-b)<ERR)

#define FORE(i,a)   for(typeof((a).begin())i=(a).begin();i!=(a).end();i++)

#define round(i,a)  i = ( a < 0 ) ? a - 0.5 : a + 0.5;
#define makeint(n,s)  istringstream(s)>>n
#define read()      freopen("test.txt","r",stdin)

#define icin3(a,b,c) scanf("%lld%lld%lld", &a, &b, &c)
#define icin2(a,b) scanf("%lld%lld", &a, &b)
#define icin1(a) scanf("%lld", &a)

#define dcin3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define dcin2(a,b) scanf("%lf%lf",&a,&b)
#define dcin1(a) scanf("%lf",&a)

using namespace std;

//ll Pow(ll B,ll P){      ll R=1; while(P>0)      {if(P%2==1)     R=(R*B);P/=2;B=(B*B);}return R;}
int BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (int)R;} /// (B^P)%M
//ll Gcd(ll a,ll b){ if(b==0)return a; Gcd(b,a%b); return;}

///int rrr[]={1,0,-1,0};int ccc[]={0,1,0,-1}; //4 Direction
///int rrr[]={1,1,0,-1,-1,-1,0,1};int ccc[]={0,1,1,1,0,-1,-1,-1};//8 direction
///int rrr[]={2,1,-1,-2,-2,-1,1,2};int ccc[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
///int rrr[]={2,1,-1,-2,-1,1};int ccc[]={0,1,1,0,-1,-1}; //Hexagonal Direction
///int month[]={31,28,31,30,31,30,31,31,30,31,30,31}; //month

//ll fact[] = {1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000};

ll ncr(ll a, ll b)
{
    ll res = 1;
    b=max(b,a-b);
    for(ll i=b+1 , j=1 ;i<=a ; i++,j++)
        res=((res*i)/j);

    return res;
}

ll npr(ll a, ll b)
{
    ll res = 1;
    for(ll i=a-b+1; i<=a; i++)
        res*=i;

    return res;
}

string decimal_to_binary(ll cur)
{
    string v;
    while(cur)
    {
        v.pb((cur%2)+'0');
        cur/=2;
    }
    return v;
}

long long lcm(ll x, ll y)
{
    ll r;
    r = __gcd(x,y);
    return ((r/x)*y);
}

ll power(ll a, ll b)
{
    ll ans = 1;
    for(int i=0; i<b; i++)ans*=a;
    return ans;
}

//void factorial(ll mm){fact[0]=fact[1]=1;fact[2]=2;for(int i=3; i<1001; i++)fact[i]=(i*fact[i-1])%mm;}
ll vagerMod(ll a, ll b, ll mm){return ((a%mm)*(BigMod(b,mm-2,mm)))%mm;}

//9,9+90*2,9+90*2+900*3,9+90*2+900*3+9000*4,9+90*2+900*3+9000*4+90000*5,9+90*2+900*3+9000*4+90000*5+900000*6,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7+90000000*8
ll arrToNumberOfDigits[]={9,9+90*2,9+90*2+900*3,9+90*2+900*3+9000*4,9+90*2+900*3+9000*4+90000*5,9+90*2+900*3+9000*4+90000*5+900000*6,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7+90000000*8};

//int loop1[]={1,1,1,0,0,-1,-1,-1};
//int loop2[]={-1,0,1,-1,1,1,0,-1};

//int color[1000000];
//int cpp[1000000];

pall MV(ll a, ll b, ll c, ll d){pall aa;aa.fr=c-a;aa.sc=d-b;return aa;}
ll CP(ll a, ll b, ll c, ll d){return (a*d-b*c);}

string cut_leading_zero(string a)
{
    string s;
    int i;
    if(a[0]!='0')   return a;
    REP(i,SZ(a)-1)  if(a[i]!='0')   break;
    FOR(i,i,SZ(a))  s+=a[i];
    return s;
}

ll T, C=1, N;ll n;
ll pas_Tree[111][111], dp[111][111], arr[11];

#define mm 1000000007

void buildPascalTriangle()
{
    //ms(pas_Tree,0);
    pas_Tree[0][0]=1;
    for(int i=1; i<=n; i++)
    {
        pas_Tree[i][0]=1;
        for(int j=1; j<=i; j++)
        {
            pas_Tree[i][j]=(pas_Tree[i-1][j-1]+pas_Tree[i-1][j])%mm;
        }
    }
}

ll dyanP()
{
    //ms(dp,0);
    ll ret=0;
    for(ll i=0; i<=n; i++)
    {
        ms(dp,0);
        dp[0][0]=1;
        for(ll j=0; j<=9; j++)
        {
            for(ll k=0; k<=i; k++)
            {
                if(dp[j][k])
                {
                    for(ll z=arr[j]; z<=(i-k+0); z++)
                    {
                        if(!j)
                        {
                            dp[j+1][z+k]=(dp[j+1][z+k]+dp[j][k]*pas_Tree[i-k-1][z])%mm;
                        }
                        else
                        {
                            dp[j+1][z+k]=(dp[j+1][z+k]+dp[j][k]*pas_Tree[i-k][z])%mm;
                        }
                    }
                }
            }
        }
        ret=(ret+dp[10][i])%mm;
    }
    return ret;
}

void process()
{
    cin>>n;
    for(ll i=0; i<10; i++)cin>>arr[i];
    buildPascalTriangle();
    cout<<dyanP()<<endl;
    return;
}

int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    process();
    return 0;
}

/*

ID: jbsu321
PROG: test
LANG: C++

*/

#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <list>
#include <bitset>
#include <ctime>

#define ms(a,b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define pi (2*acos(0))
#define oo 1<<29
#define dd double
#define ll long long
#define ff float
#define MP make_pair
#define EPS 10E-10
#define fr first
#define sc second
#define MAXX 100
#define SZ(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define intlim 2147483648
#define rtintlim 46340
#define llim 9223372036854775808
#define rtllim 3037000499
#define pall pair<ll,ll>
#define padd pair<dd,dd>
#define paii pair<int,int>
#define ull unsigned long long
#define csprint printf("Case %lld: ", C++)
#define bpc __builtin_popcount

#define REP(i,N)  for(i=0;i<N;i++)
#define REV(i,N)  for(i=N;i>=0;i--)
#define FOR(i,p,k) for (i=p; i<k;i++)

#define ISS         istringstream
#define OSS         ostringstream
#define VS          vector<string>
#define vi          vector<int>
#define vd          vector<double>
#define vll         vector<long long>
#define SII         set<int>::iterator
#define SI          set<int>
#define mem(a,b)    memset(a,b,sizeof(a))
#define fs          first
#define sc          second
#define pii         pair < int , int >

#define EQ(a,b)     (fabs(a-b)<ERR)

#define FORE(i,a)   for(typeof((a).begin())i=(a).begin();i!=(a).end();i++)

#define round(i,a)  i = ( a < 0 ) ? a - 0.5 : a + 0.5;
#define makeint(n,s)  istringstream(s)>>n
#define read()      freopen("test.txt","r",stdin)

#define icin3(a,b,c) scanf("%lld%lld%lld", &a, &b, &c)
#define icin2(a,b) scanf("%lld%lld", &a, &b)
#define icin1(a) scanf("%lld", &a)

#define dcin3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define dcin2(a,b) scanf("%lf%lf",&a,&b)
#define dcin1(a) scanf("%lf",&a)

using namespace std;

//ll Pow(ll B,ll P){      ll R=1; while(P>0)      {if(P%2==1)     R=(R*B);P/=2;B=(B*B);}return R;}
int BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (int)R;} /// (B^P)%M
//ll Gcd(ll a,ll b){ if(b==0)return a; Gcd(b,a%b); return;}

///int rrr[]={1,0,-1,0};int ccc[]={0,1,0,-1}; //4 Direction
///int rrr[]={1,1,0,-1,-1,-1,0,1};int ccc[]={0,1,1,1,0,-1,-1,-1};//8 direction
///int rrr[]={2,1,-1,-2,-2,-1,1,2};int ccc[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
///int rrr[]={2,1,-1,-2,-1,1};int ccc[]={0,1,1,0,-1,-1}; //Hexagonal Direction
///int month[]={31,28,31,30,31,30,31,31,30,31,30,31}; //month

//ll fact[] = {1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000};

ll ncr(ll a, ll b)
{
    ll res = 1;
    b=max(b,a-b);
    for(ll i=b+1 , j=1 ;i<=a ; i++,j++)
        res=((res*i)/j);

    return res;
}

ll npr(ll a, ll b)
{
    ll res = 1;
    for(ll i=a-b+1; i<=a; i++)
        res*=i;

    return res;
}

string decimal_to_binary(ll cur)
{
    string v;
    while(cur)
    {
        v.pb((cur%2)+'0');
        cur/=2;
    }
    return v;
}

long long lcm(ll x, ll y)
{
    ll r;
    r = __gcd(x,y);
    return ((r/x)*y);
}

ll power(ll a, ll b)
{
    ll ans = 1;
    for(int i=0; i<b; i++)ans*=a;
    return ans;
}

//void factorial(ll mm){fact[0]=fact[1]=1;fact[2]=2;for(int i=3; i<1001; i++)fact[i]=(i*fact[i-1])%mm;}
ll vagerMod(ll a, ll b, ll mm){return ((a%mm)*(BigMod(b,mm-2,mm)))%mm;}

//9,9+90*2,9+90*2+900*3,9+90*2+900*3+9000*4,9+90*2+900*3+9000*4+90000*5,9+90*2+900*3+9000*4+90000*5+900000*6,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7+90000000*8
ll arrToNumberOfDigits[]={9,9+90*2,9+90*2+900*3,9+90*2+900*3+9000*4,9+90*2+900*3+9000*4+90000*5,9+90*2+900*3+9000*4+90000*5+900000*6,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7,9+90*2+900*3+9000*4+90000*5+900000*6+9000000*7+90000000*8};

//int loop1[]={1,1,1,0,0,-1,-1,-1};
//int loop2[]={-1,0,1,-1,1,1,0,-1};

//int color[1000000];
//int cpp[1000000];

pall MV(ll a, ll b, ll c, ll d){pall aa;aa.fr=c-a;aa.sc=d-b;return aa;}
ll CP(ll a, ll b, ll c, ll d){return (a*d-b*c);}

string cut_leading_zero(string a)
{
    string s;
    int i;
    if(a[0]!='0')   return a;
    REP(i,SZ(a)-1)  if(a[i]!='0')   break;
    FOR(i,i,SZ(a))  s+=a[i];
    return s;
}

ll T, C=1, N;ll n;
ll pas_Tree[111][111], dp[111][111], arr[11];

#define mm 1000000007

void buildPascalTriangle()
{
    ms(pas_Tree,0);pas_Tree[0][0]=1;
    for(int i=1; i<=n; i++)
    {
        pas_Tree[i][0]=1;
        for(int j=1; j<=i; j++)
        {
            pas_Tree[i][j]=(pas_Tree[i-1][j-1]+pas_Tree[i-1][j])%mm;
        }
    }
}

ll dyanP()
{
    //ms(dp,0);
    ll ret=0;
    for(ll i=0; i<=n; i++)
    {
        ms(dp,0);
        dp[0][0]=1;
        for(ll j=0; j<=9; j++)
        {
            for(ll k=0; k<=i; k++)
            {
                if(dp[j][k])
                {
                    for(ll z=arr[j]; z<=(i-k); z++)
                    {
                        if(!j)
                        {
                            dp[j+1][z+k]=(dp[j+1][z+k]+dp[j][k]*pas_Tree[i-k-1][z])%mm;
                        }
                        else
                        {
                            dp[j+1][z+k]=(dp[j+1][z+k]+dp[j][k]*pas_Tree[i-k][z])%mm;
                        }
                    }
                }
            }
        }
        ret=(ret+dp[10][i])%mm;
    }
    return ret;
}

void process()
{
    cin>>n;
    for(ll i=0; i<10; i++)cin>>arr[i];
    buildPascalTriangle();
    cout<<dyanP()<<endl;;
    return;
}

int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    process();
    return 0;
}

#include<bits/stdc++.h>

const int N = 110;
const int moder = 1e9 + 7;

int fac[N], inv[N];
int a[N];

int powermod(int a, int exp){
	int ret = 1;
	for ( ; exp > 0; exp >>= 1){
		if (exp & 1){
			ret = 1ll * ret * a % moder;
		}
		a = 1ll * a * a % moder;
	}
	return ret;
}

int dp[N];

int calc(int n){
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;
	for (int i = 0; i < 10; ++ i){
		for (int j = N - 1; j >= 0; -- j){
			int x = dp[j];
			dp[j] = 0;
			for (int k = a[i]; k <= n; ++ k){
				if (j + k >= N) break;
				dp[j + k] = (dp[j + k] + 1ll * x * inv[k]) % moder;
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; ++ i){
		ans = (ans + 1ll * dp[i] * fac[i]) % moder;
	}
	return ans;
}

int main(){
	fac[0] = 1;
	for (int i = 1; i < N; ++ i){
		fac[i] = 1ll * fac[i - 1] * i % moder;
	}
	inv[N - 1] = powermod(fac[N - 1], moder - 2);
	for (int i = N - 1; i; -- i){
		inv[i - 1] = 1ll * inv[i] * i % moder;
	}
	int n;
	scanf("%d", &n);
	for (int i = 0; i < 10; ++ i){
		scanf("%d", &a[i]);
	}
	int ans = calc(n);
	if (a[0] > 0){
		-- a[0];
	}
	ans -= calc(n - 1);
	ans += ans < 0 ? moder : 0;
	bool flag = a[0] <= 1;
	for (int i = 1; i < 10; ++ i){
		flag = flag && !a[i];
	}
	if (flag){
		-- ans;
		ans += ans < 0 ? moder : 0;
	}
	printf("%d\n", ans);
	return 0;
}

#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <climits>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ff first
#define ss second
#define LL long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define sqr(x) ((x) * (x))
#define PI 3.1415926535897932384626433832795
using namespace std;

LL n, i, l, j, k, ans = 0ll, a[11], dp[111][111], c[111][111];

int main() {
    for(i = 0; i <= 100; i++) {
        c[i][0] = 1;
        for(l = 1; l <= i; l++) {
            c[i][l] = (c[i - 1][l - 1] + c[i - 1][l]) % MOD;
        }
    }
    dp[10][0] = 1; scanf("%lld", &n);
    for(i = 0; i < 10; i++) scanf("%lld", &a[i]);
    for(i = 9; i > 0; i--) {
        for(l = 0; l <= n; l++) {
            k = 0; for(j = a[i]; j <= l; j++)
                k = (k + dp[i + 1][l - j] * c[l][j]) % MOD;
            dp[i][l] = k;
        }
    }
    for(i = a[0]; i <= n; i++) {
        for(l = a[0]; l < i; l++) {
            ans = (ans + dp[1][i - l] * c[i - 1][l]) % MOD;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

LL c[110][110],mod=(1e9)+7,n,a[10],memo[110][110];

void precompute(){
	c[0][0] = 1;
	for(int i=1;i<=100;i++){
		c[i][0] = 1;
		for(int j=1;j<=i;j++){
			c[i][j] = (c[i-1][j] + c[i-1][j-1]) % mod;
		}
	}
}

LL solve(LL len, LL digit){
	if(digit==10){
		if(len==0) return 1;
		return 0;
	}
	if(len<0) return 0;
	if(memo[len][digit]!=-1) return memo[len][digit];
	LL ret = 0;
	for(int i=a[digit];i<=len;i++){
		if(digit==0) ret += (solve(len-i, digit+1) * c[len-1][i])%mod;
		else ret += (solve(len-i, digit+1) * c[len][i])%mod;
		ret %= mod;
	}
	return memo[len][digit] = ret;
}

int main() {
	scanf("%lld",&n);
	for(int i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	precompute();
	memset(memo,-1,sizeof(memo));
	LL ans=0;
	for (int i=1;i<=n;i++){
		ans = (ans + solve(i, 0)) % mod;
	}
	printf("%lld\n",ans);
	return 0;
}

//                             In The Name Of Allah
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
using namespace std;

const int N = 1e2 + 1100, OO = 1e9 + 7, M = 1e9 + 7, P = 769, sq = 360, lg = 23;
typedef pair <int, int> pii;
int a[20], dp[20][N], fac[N], inv[N];

int pw(int x, int y) {
	if(y == 0)
		return 1;
	int cnt = pw(x, y / 2);
	cnt = (cnt * cnt) % M;
	cnt = (cnt * (y % 2 == 1 ? x : 1)) % M;
	return cnt;
}

void prepro() {
	fac[0] = 1;
	for(int i = 1; i <= N - lg; i++)
		fac[i] = (fac[i - 1] * i) % M;
	inv[N - lg] = pw(fac[N - lg], M - 2);
	for(int i = N - lg - 1; i > -1; i--)
		inv[i] = (inv[i + 1] * (i + 1)) % M;
}

int c(int x, int y) {
	return ((fac[x] * inv[y] % M) * inv[x - y]) % M;
}

int32_t main() {
    use_fast;
    prepro();
    int n, m;
    cin >> n;
	for(int i = 0; i < 10; i++)
		cin >> a[i];
	int ans = 0;
	while(n) {
		memset(dp, 0, sizeof(dp));
		for(int i = a[0]; i < n; i++)
			dp[0][n - i] = c(n - 1, i);
		for(int i = 1; i < 10; i++) {
			for(int j = 0; j <= n; j++) {
				for(int k = a[i]; j + k <= n; k++)
					dp[i][j] = (dp[i][j] + dp[i - 1][j + k] * c(j + k, k)) % M;
			}
		}
		n--;
		ans = (ans + dp[9][0]) % M;
	}
	cout << ans << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ...
*/

#include <bits/stdc++.h>
#define MOD 1000000007

typedef long long ll;

int arr[10];
ll factx[101], invf[101];
ll memo[101][11][2];

ll modexp(ll a, ll n)
{
	ll res = 1;
	while(n)
	{
		if(n & 1)
		res = ((res%MOD) * (a%MOD))%MOD;
		a = ((a%MOD) * (a%MOD))%MOD;
		n >>= 1;
	}
	return res;
}

void factup(void)
{
	factx[0] = 1;
	invf[0] = 1;
	for(ll i=1;i<101;i++)
	{
		factx[i] = ((factx[i-1]%MOD) * (i%MOD))%MOD;
		invf[i] = modexp(factx[i], MOD-2)%MOD;
	}
	return;
}

ll duakal(int sp, int i, int lz)
{
	if(sp < 0)
	return 0;
	else if(i == 10)
	{
		if(!sp)
		return 1;
		else return 0;
	}
	if(memo[sp][i][lz] != -1)
	return memo[sp][i][lz];
	ll ans = 0;
	for(ll j=arr[i];j<=sp;j++)
	ans = ((ans%MOD) + (((duakal(sp-j, i+1, lz)%MOD) * (invf[j]%MOD))%MOD))%MOD;
	memo[sp][i][lz] = ans;
	return ans;
}

int main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	memset(memo, -1, sizeof(memo));
	factup();
	int n;
	std::cin>>n;
	for(int i=0;i<10;i++)
	std::cin>>arr[i];
	ll ans = 0;
	int cz = 0;
	for(int i=1;i<=n;i++)
	ans = ((ans%MOD) + (((factx[i]%MOD) * (duakal(i, 0, cz)%MOD))%MOD))%MOD;
	if(arr[0])
	{
		cz = 1;
		arr[0]--;
	}
	for(int i=n;i>=1;i--)
	ans = ((ans%MOD) - (((factx[i-1]%MOD) * (duakal(i-1, 0, cz)%MOD))%MOD) + MOD)%MOD;
	std::cout<<ans<<"\n";
	return 0;
}

#include <bits/stdc++.h>

using namespace std ;
typedef long long ll ;
const int MX =  400  ;
const ll delta = (ll) 1e9 + 7 ;
ll n , a[100];
ll c[MX][MX] , dp[MX][MX] ,ret;
int main (){
	cin >> n ;
	for ( int i = 0 ;i < 10 ;i ++ )
		cin >> a[i] ;
	for (int i = 0 ;i < 103 ; i ++ )
		for ( int j = 0 ; j <103 ; j ++ )
			c[i][j] = ( i < j?0: ( j==0?1:c[i-1][j-1] + c[i-1][j])) % delta ;
	dp[10][0] = 1 ;
for (int i = 9; i  > 0 ;i--)
		for (int j = 0 ; j <= n ;j++)
			for (int k = a[i] ; k <= j ; k++){

				dp[i][j]= ( dp[i][j] + (dp[i+1][j-k] * c[j][k] ) % delta ) % delta ;
			}
	for ( int j = a[0] ; j <= n ;j ++  )
		for ( int k = a[0] ; k < j ;k ++ )
			if ( j != 0 )
			ret= ( ret + dp[1][j-k]  * c[j-1][k]) % delta  ;
			cout <<ret<< endl;

	return 0;
 }

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <map>
#include <string.h>

typedef long long ll;

const int N=110;
const int inf=0x3f3f3f3f;
const ll mod=1000000007ll;

using namespace std;

int n,a[110];

ll c[N][110];

void init()
{
    c[0][0]=1;
    for(int i=1;i<=100;i++)
    {
        c[i][0]=1;
        for(int j=1;j<=100;j++)
            c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
    }
}

ll dp[11][N];

ll solve(int n,int a[])
{
    init();
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=0;i<10;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(dp[i][j]==0) continue;
            for(int k=a[i+1];k+j<=n;k++)
                dp[i+1][j+k]=(dp[i][j]*c[j+k][k]+dp[i+1][j+k])%mod;
        }
    }
    return dp[10][n];
}

int main()
{
    int sum=0;
    scanf("%d",&n);
    for(int i=1;i<=10;i++)
        scanf("%d",&a[i]),sum+=a[i];
    ll ret=0;
    for(int k=max(1,sum);k<=n;k++)
    {
        if(k==1)
        {
            if(sum==1) ret++;
            else ret+=9;
            continue;
        }
        for(int i=2;i<=10;i++)
        {
            int f=1;
            if(a[i]==0) f=0;
            a[i]-=f;
            ret+=solve(k-1,a);
            ret%=mod;
            a[i]+=f;
        }
    }
    cout<<(ret%mod)<<endl;
    return 0;
}

//#pragma comment(linker, "/STACK:20000000")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>

using namespace std;
typedef long long int64;
#ifdef HOME
	#define E(c) cerr<<#c
	#define Eo(x) cerr<<#x<<" = "<<(x)<<endl
	#define Ef(...) fprintf(stderr, __VA_ARGS__)
#else
	#define E(c) ((void)0)
	#define Eo(x) ((void)0)
	#define Ef(...) ((void)0)
#endif

const int MOD = 1000000007;

inline void add(int &a, int b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
inline void sub(int &a, int b) {
	a -= b;
	if (a < 0) a += MOD;
}
inline int mult(int a, int b) {
	return (int64(a) * b) % MOD;
}

const int SIZE = 128;
int comb[SIZE][SIZE];
int res[16][SIZE];

int SolveX(int len, vector<int> cnt) {
	memset(res, 0, sizeof(res));
	res[0][0] = 1;
	for (int i = 0; i<10; i++)
		for (int j = 0; j<=len; j++) if (res[i][j]) {
			for (int q = cnt[i]; j+q<=len; q++) {
//				printf("%d %d %d %d %d %d\n", i, j, i+1, j+q, comb[j+q][q], res[i][j]);
				add(res[i+1][j+q], mult(comb[j+q][q], res[i][j]));
			}
	}
	return res[10][len];
}

int Solve(int len, vector<int> cnt) {
	int res = SolveX(len, cnt);
	vector<int> q = cnt;
	if (q[0]) q[0]--;
	sub(res, SolveX(len-1, q));
	return res;
}

int n;
vector<int> arr;

int main() {
#ifdef HOME
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	for (int i = 0; i<SIZE; i++) {
		comb[i][0] = comb[i][i] = 1;
		for (int j = 1; j<=i-1; j++) {
			comb[i][j] = comb[i-1][j-1];
			add(comb[i][j], comb[i-1][j]);
		}
	}

	scanf("%d", &n);
	arr.resize(10);
	for (int i = 0; i<10; i++)
		scanf("%d", &arr[i]);

	int ans = 0;
	for (int i = 1; i<=n; i++)
		add(ans, Solve(i, arr));
	printf("%d\n", ans);

	return 0;
}

#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int mod = 1e9 + 7, N = 105;
typedef long long ll;
ll K, a[15], ans,tot, bit[N * N], f[10][N * N], c[N][N];

ll quick_pow(ll a, ll b) {
	ll ret = 1;
	for (; b; b >>= 1) {
		if (b & 1) ret = ret * a % mod;
		a = a * a % mod;
	} return ret;
}

void init() {
	c[0][0] = 1;
	rep(i, 1, K) {
		c[i][0] = 1;
		rep(j, 1, K)
			c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
	}
}

int main() {
	cin >> K;
	rep(i, 0, 9) cin >> a[i], tot += a[i];

	init();

	--K;
	--tot;

	rep(o, 1, 9) {
		--a[o];
		memset(f, 0, sizeof(f));
		rep(i, a[0], K) f[0][i] = c[K][i];
		rep(i, 1, 9) {
			rep(j, a[i], K) {
				rep(k, 0, K - j) {
					f[i][j + k] = (f[i][j + k] + f[i - 1][k] * c[K - k][j]) % mod;
				}
			}
		}
		rep(j, tot, K) {
			ans = (ans + f[9][j] * quick_pow(c[K][j], mod - 2) % mod) % mod;
		}
		++a[o];
	}

	printf("%lld\n", ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
#define MOD 1000000007
#define mod(a) (a)%MOD
#define pb push_back
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define ft first
#define sd second
#define mp make_pair
#define dbg(x) cout<<#x<<" = "<<x<<"\n"
#define dbg2(x,y) cout<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<"\n"
#define dbg3(x,y,z) cout<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<" , "<<#z<<" = "<<z<<"\n"
#define INF (1LL<<60)
#define endl '\n'
ll gcd(ll a,ll b){if(a==0) return b; return gcd(b%a,a);}
ll powm(ll base,ll exp,ll mod=MOD) {base%=mod;ll ans=1;while(exp){if(exp&1LL) ans=(ans*base)%mod;exp>>=1LL,base=(base*base)%mod;}return ans;}

int a[10];
ll dp[101][10];
ll c[101][101];
int main(){
      sync;
      ll n;
      cin>>n;
      c[0][0]=1;
      c[1][0]=c[1][1]=1;
      for(int i=2;i<=100;i++){
          c[i][0]=1;
          for(int j=1;j<=i;j++){
              c[i][j]=mod(c[i-1][j]+c[i-1][j-1]);
          }
      }

      for(ll i=0; i<10; i++){
            cin>>a[i];
      }
      ll ans=0,sum=0;
      for(int i=9;i>=0;i--){
          sum+=a[i];
          dp[0][i] = (sum==0);
      }
      for(int i=1;i<=n;i++){
          for(int j=9;j>=0;j--){
              if(j==9){
                   dp[i][j]=(a[j]<=i);
                   continue;
              }

              for(int k=a[j];k<=n;k++){
                  if(i<=k && j==0) continue;
                  if(i<k) continue;
                  dp[i][j]=mod(dp[i][j]+mod(dp[i-k][j+1]*c[i-(j?0:1)][i-k-(j?0:1)]));
              }

          }
      }
       for(int i=max(1,a[0]);i<=n;i++) ans=mod(ans+dp[i][0]);
       cout<<ans<<endl;
}

#if 1
#include <algorithm>
#include <iostream>
#include <vector>
#include <bitset>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#pragma comment (linker,"/STACK:36777216")
using namespace std;

#define START clock_t _clock = clock();
#define END cerr <<"used ms "<< (clock() - _clock) / long double (CLOCKS_PER_SEC) << '\n';
#define endline '\n';

const long long mod = 1e9 + 7;
const int nmax = 100;
long long dp[nmax + 1][10];
long long Cs[nmax + 1][nmax + 1];

int main()
{
    for(int i = 0; i <= nmax; i++)
    {
        Cs[i][0] = Cs[i][i] = 1;
        for(int j = 1; j < nmax; j++)
            Cs[i][j] = (Cs[i-1][j] + Cs[i-1][j-1]) % mod;
    }

    int size;
    cin>>size;
    vector<int> counts(10);
    for(int i = 0; i < 10; i++) cin>>counts[i];
    for(int i = 0; i <= size; i++)
    {
        dp[i][9] = (i >= counts[9] ? 1 : 0);
        for(int dig = 8; dig > 0; dig--)
        {
            for(int j = counts[dig]; j <= i; j++)
            if(i - j >= 0)
            dp[i][dig] = (   dp[i][dig] + dp[i-j][dig + 1] * Cs[i][j]   ) % mod;
        }

        if(i)
        {
            for(int j = counts[0]; j <= i; j++)
            if(i - 1 - j >= 0)
            dp[i][0] = (   dp[i][0] + dp[i-j][1] * Cs[i-1][j]   ) % mod;
        }
    }
    long long ans = 0;
    for(int i = 1; i <= size; i++) ans += dp[i][0];
    cout << ans % mod << '\n';
    return 0;
}
#endif
/*
1
0 0 0 0 0 0 0 0 0 1

*/

// Problem : B. Numbers
// Contest : Codeforces - Codeforces Round #131 (Div. 1)
// URL : https://codeforces.com/problemset/problem/213/B
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long
#define N 120

int n,a[10],dp[N][11];

int binpow(int x,int y){
    x %= mod;
    int res = 1;
    while(y){
        if(y&1) res = (res*x)%mod;
        x = (x*x)%mod;
        y = y/2;
    }
    return res;
}

int inv(int a){
    return binpow(a,mod-2);
}

int fact[N], invfact[N];

void precompute(){
    fact[0] = 1;
    for(int i=1;i<N;i++) fact[i] = (fact[i-1]*i)%mod;
    invfact[N-1] = inv(fact[N-1])%mod;
    for(int i=N-2;i>=0;i--) invfact[i] = (invfact[i+1]*(i+1))%mod;
}

int ncr(int n, int r){
    if(n<r) return 0;
    return (((fact[n]*invfact[r])%mod)*invfact[n-r])%mod;
}

int f(int len, int i){
    if(i == 9) return len >= a[9];
    int &ret = dp[len][i];
    if(ret != -1) return ret;
    ret = 0;
    for(int k=a[i];k<=len;k++){
        int t1 = f(len-k,i+1);
        int t2 = i ? ncr(len,k) : ncr(len-1,k);
        ret = (ret + (t1*t2)%mod)%mod;
    }
    return ret;
}

void solve(){
    cin>>n;
    precompute();
    for(int i=0;i<10;i++) cin>>a[i];
    memset(dp,-1,sizeof(dp));
    int ans = 0;
    for(int i=1;i<=n;i++) ans = (ans+f(i,0))%mod;
    cout<<ans<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define mem(a, b) memset(a, (b), sizeof(a))
#define repd(i,k) for(int i=k;i>=0;i--)
#define rep(i,k) for(int i=0;i<k;i++)
#define repn(i,k1,k2) for(ll i=k1;i<k2;i++)
#define sz(x) (ll)(x).size()
#define ff first
#define ss second

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define ee6 (ll)1000001
#define ee5 (ll)100001

#define tt ll t;cin>>t; while(t--)
typedef long long int ll;

typedef pair<ll, ll> pr;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pr> vpr;
typedef vector<vpr>vvpr;
typedef vector<vi> vvi;
typedef map<ll,ll> MPII;
typedef set<ll> SETI;
typedef multiset<ll> MSETI;
//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;

ll powmod(ll a, ll e) {
	if (e == 0) return 1;
	ll x = powmod(a * a % MOD, e >> 1);
	return e & 1 ? x * a % MOD : x;
}

const int N=2*ee6;
ll fact[N],inv[N],invfact[N];
void pre2()
{
	fact[0]=1;
	for(int i=1;i<N;i++)
		fact[i]=(fact[i-1]*i)%MOD;
	//calculate inverses of [1,N] mod p
	inv[1]=1;
	for(int i=2;i<N;i++)inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;

	invfact[0]=1;
	for(int i=1;i<N;i++)invfact[i]=(invfact[i-1]*inv[i])%MOD;
}

ll ncr(ll n,ll r)
{
	if(r>n)return 0;
	return fact[n]*invfact[r]%MOD*invfact[n-r]%MOD;
}

void inline add(ll &x,ll y)
{x=(x+y)%MOD;}

ll dp[101][10];ll a[10];

int main()
{
	#if !ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	pre2();
	ll n;cin>>n;
	rep(i,10)cin>>a[i];

	for(int d=9;d>=0;d--)
		if(a[d])break;
		else dp[0][d]=1;

	ll s=0;
	for(ll x=1;x<=n;x++)
	{
		for(ll dig=9;dig>=0;dig--)
		{
			if(dig==9)
			dp[x][dig]=(a[9]<=x);
			else
			{
				for(ll how=a[dig];how<=x;how++)
				{
					add(dp[x][dig],dp[x-how][dig+1]*ncr(x-(dig==0),how));
				}
			}
		}
		add(s,dp[x][0]);
	}
	cout<<s;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;

const LL MOD = 1000 * 1000 * 1000 + 7;

LL C[1 << 8][1 << 8];
LL dp[10][10][1 << 8];

int a[10];
int n;

LL f(int st, int dig, int n)
{
	if (dig == 10)
		return n == 0;
	LL & res = dp[st][dig][n];
	if (res != -1)
		return res;
	res = 0;
	int c = a[dig];
	if (dig == st)
		c = max(0, c - 1);
	for(int i = 0; i <= n; ++i)
	{
		if (c > i)
			continue;
		res += C[n][i] * f(st, dig + 1, n - i);
		res %= MOD;
	}
	return res;
}

int main()
{
	for(int i = 0; i < 1 << 8; ++i)
		C[i][i] = 1, C[i][0] = 1;
	for(int i = 1; i < 1 << 8; ++i)
		for(int j = 1; j < i; ++j)
			C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
	cin >> n;
	for(int i = 0; i < 10; ++i)
		cin >> a[i];
	LL res = 0;
	memset(dp, -1, sizeof(dp));
	for(int i = 1; i <= 9; ++i)
		for(int len = 1; len <= n; ++len)
			res = (res + f(i, 0, len - 1)) % MOD;
	//int t = 0;
	//for(int i = 1; i < 10; ++i)
	//	t += a[i];
	//if (t == 0 && a[0] <= 1)
	//	res = (res + 1) % MOD;
	cout << res << endl;
	return 0;
}

#include<iostream>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;

const ll M=1000000007;

const int N_BIN=200;
ll nCr[N_BIN+1][N_BIN+1];
void binom(){
	rep(n,N_BIN+1) nCr[n][0]=1;
	rep(n,N_BIN) rep(r,n+1) nCr[n+1][r+1]=(nCr[n][r+1]+nCr[n][r])%M;
}

ll nHr(int n,int r){ return nCr[n+r-1][r]; }

int main(){
	binom();

	int n,a[10]; cin>>n;
	rep(i,10) cin>>a[i];

	// dp の各時点で、スロットの長さ j は異なる
	// dp[i+1][j] := ( 数字 i までを使って、長さ j のスロットをぴったり全部埋める場合の数 )
	ll dp[11][101]={};
	dp[10][0]=1;
	for(int i=9;i>=0;i--) rep(j,n+1) {
		for(int k=a[i];k<=n;k++){ // 数字 i を k 個使う
			if(j+k>n) break;
			if(i!=0){
				dp[i][j+k]=(dp[i][j+k]+dp[i+1][j]*nHr(j+1,k))%M;
			}
			else{ // i==0 ( 0 だけはスロットの先頭に入れられないので例外的に扱う )
				dp[0][j+k]=(dp[0][j+k]+dp[1][j]*nHr(j,k))%M;
			}
		}
	}

	ll ans=0;
	for(int len=1;len<=n;len++) ans=(ans+dp[0][len])%M;
	cout<<ans<<endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int Mod=1e9+7;
const int N=105;
int n, a[N], kq[N][N], dp[N][N], res=0;
main()
{
	cin>>n;
	for(int i=0; i<=9; i++)cin>>a[i];
	for(int i=0; i<=n; i++)
		for(int j=0; j<=n; j++)
			dp[j][i]= i==j || j==0 ? 1 : (dp[j-1][i-1] + dp[j][i-1]) % Mod;
		for(int i = a[9]; i <= n ; ++i) kq[9][i] = 1;
	for(int i=8; i>=0; i--)
		for(int sl=a[i]; sl<=n; sl++)
			for(int x=a[i]; x<=sl; x++)
				kq[i][sl]=i!=0 ? (kq[i][sl] + kq[i+1][sl-x]*dp[x][sl]) % Mod
							   : (kq[i][sl] + kq[i+1][sl-x]*dp[x][sl-1])%Mod;
	for(int i=0; i<=n; i++)res=(res + kq[0][i])%Mod;
		cout<<res;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

int ToInt ( string & s, int len ) { int r = 0; REP(i,len) { r *= 10; r += s[i] - '0'; } return r; }
int GCD ( int a, int b ) { return b != 0 ? GCD(b, a % b) : a; }
int LCM ( int a, int b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

const int MAX = 101;
const int MOD = 1000000007;
int a[ 10 ];
LL comb[ MAX ][ MAX ];

void CombAll ()
{
    comb[ 0 ][ 0 ] = 1;
    comb[ 1 ][ 0 ] = 1;
    comb[ 1 ][ 1 ] = 1;
    FOR(i,2,MAX)
    {
        comb[i][0] = 1;
        FOR(j,1,i)
            comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % MOD;
        comb[ i ][ i ] = 1;
    }
}

int dp[ MAX ][ 11 ];    // pocet cisel dane delky

int main ()
{
    CombAll();
    int N;
    while ( scanf( "%d", &N ) == 1 )
    {
        REP(i,10)
            scanf( "%d", &a[i] );

        int res = 0;
        FOR(firstDigit,1,10)
        {
            FILL(dp,0);
            dp[0][0] = 1;

            --a[ firstDigit ];
            REP(digit,10)
            {
                /*
                REP(oldLen,N)
                    if ( dp[ oldLen ][ digit ] != 0 )
                        FOR(curCount,std::max( 0, a[digit] ),N - oldLen)
                        {
                            int len = oldLen + curCount;
                            dp[ len ][ digit + 1 ] = (dp[ len ][ digit + 1 ] + dp[ oldLen ][ digit ] * (LL)comb[ len ][ curCount ]) % MOD;
                        }
                */
                REP(len,N)
                    FOR(count,a[digit],N)
                        dp[ len ][ digit + 1 ] = (dp[ len ][ digit + 1 ] + dp[ len - count ][ digit ] * (LL)comb[ len ][ count ]) % MOD;
            }
            ++a[ firstDigit ];

            REP(i,N)
                res = (res + dp[ i ][ 10 ]) % MOD;
        }
        printf( "%d\n", res );
    }

    return 0;
}

#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
typedef long long ll;
const ll mm=1e9+7;
ll Pow(ll x,ll y){
	ll ans=1;
	while (y){
		if (y&1) ans=1ll*ans*x%mm;
		x=1ll*x*x%mm;
		y/=2;
	}
	return ans;
}
int a[11],n;
ll f[205][20],pw[205],inv[205],ans;
int main(){
	scanf("%d",&n);
	rep(i,0,9) scanf("%d",&a[i]);
	pw[0]=1; rep(i,1,100) pw[i]=pw[i-1]*i%mm;
	inv[100]=Pow(pw[100],mm-2);
	for (int i=100;i>0;i--) inv[i-1]=inv[i]*i%mm;
	f[0][10]=1;
	for (int i=9;i>=1;i--){
		rep(j,0,n) if (f[j][i+1]){
			rep(k,a[i],n-j)	(f[j+k][i]+=f[j][i+1]*inv[k]%mm)%=mm;
		}
	}
	ans=0;
	rep(j,1,n) if (f[j][1]){
		rep(k,a[0],n-j) {
			(ans+=pw[j+k]*f[j][1]%mm*inv[k]%mm)%=mm;
			if (k>0) (ans+=mm-pw[j+k-1]*inv[k-1]%mm*f[j][1]%mm)%=mm;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

//check check check
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<queue>
#include<cstring>
#include<map>
#include<iomanip>

#define ll long long
#define pb(x) push_back(x)

using namespace std;

typedef pair<int,int> ii;

const int NMAX = 105;
const ll MOD = 1e9+7;

ll a[NMAX],dp[NMAX][10],c[NMAX][NMAX];

int main()
{
    ll N,i,j,k;

    cin>>N;

    for(i = 0 ; i < 10 ; ++i)
        cin>>a[i];

    //precalculating the binomial coefficient
    c[0][0] = 1;
    for(i = 1 ; i <= N ; ++i)
    {
        c[i][0] = 1;
        for(j = 1 ; j <= i ; ++j)
            c[i][j] = (c[i-1][j] + c[i-1][j-1])%MOD;
    }

    //dp[i][j] = the number of numbers  of length i made satisfying the properties of digits[j..9]
    ll sum;

    for(i = 9 ; i >= 0 && a[i] == 0 ; --i)
        dp[0][i] = 1;

    for(i = 1 ; i <= N ; ++i)
    {
        if(i >= a[9])
            dp[i][9] = 1;

        for(j = 8 ; j ; --j)
        {
            sum = 0;
            for(k = a[j] ; k <= i ; ++k)
                sum = (sum + dp[i-k][j+1]*c[i][k])%MOD;
            dp[i][j] = sum;
        }

        sum = 0;
        for(k = a[0] ; k < i; ++k)
            sum = (sum + dp[i-k][1]*c[i-1][k])%MOD;
        dp[i][0] = sum;

    }
    sum = 0;

    for(i = 1 ; i <= N ; ++i)
        sum = (sum + dp[i][0])%MOD;
    cout<<sum;

    return 0;
}

#include<bits/stdc++.h>

#define FORA(i, n, ii, s) for(int i=s;i<n;i+=ii)
#define FOR(i, n) for(int i=0;i<n;i++)
#define FORD(i, n) for(int i=n;i>=0;i--)
#define FORF(i, n, s) for(int i=s;i<n;i++)
#define MIN(x, y) ((x<y)?x:y)
#define MAX(x, y) ((x>y)?x:y)
#define ll long long
#define il long
#define ii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define vii vector<ii>
#define MOD (int)(1e9 + 7)
#define INF (int)(1e9)
#define INFLL (ll)(1e18)
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;

int n;
int a[10];
int mem[1001][10];
ll c[1001][1001];

int Pascal(int n)
{
  for (int line = 0; line < n; line++){
    for (int i = 0; i <= line; i++)
    {
      if (line == i || i == 0)
           c[line][i] = 1LL;
      else
           c[line][i] = (c[line-1][i-1]%MOD + c[line-1][i]%MOD)%MOD;
    }
  	}
  	return 0;
}
ll dp(int len,int j){
	if(mem[len][j] != -1){
		return mem[len][j];
	}
	if(j == 9){
		if(len >= a[j]){
			return 1LL;
		}else return 0LL;
	}else{
		ll rtv = 0;
		if(j == 0){
			FORF(i,len+1,a[j]){
				rtv =(rtv + (dp(len-i,j+1)%MOD*c[len-1][i]%MOD)%MOD)%MOD;
			}
		}else{
			FORF(i,len+1,a[j]){
				rtv = (rtv + (dp(len-i,j+1)%MOD*c[len][i]%MOD)%MOD)%MOD;
			}
		}
		mem[len][j] = rtv%MOD;
		return rtv;
	}
	return 0;
}
int main() {
	flash;
	memset(mem,-1,sizeof(mem));
	memset(c,0,sizeof(c));
	cin>>n;
	FOR(i,10) cin>>a[i];
	Pascal(1001);
	ll ans = 0;
	int sn = 0;
	FOR(i,10) sn += a[i];
	FORF(i,n+1,MAX(sn,1)){
		ans = (ans + dp(i,0)%MOD)%MOD;
	}
	cout<<ans%MOD<<endl;
	return 0;
}

#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>

using namespace std;

#define BUG(x) if (DEBUG) cout << __LINE__ << ": " << #x << " = " << x << endl;
#define LET(x, a) __typeof(a) x = a
#define FOREACH(it, v) for(LET(it, (v).begin()); it != (v).end(); ++it)

typedef long long LL;

template <class T> inline int size(const T& c) {return (int) c.size();}
inline LL two(int x) {return (1LL << (x));}
int readInt() {int N = -1; scanf("%d", &N); return N;}
string rString() {char buffer[1 << 20]; scanf("%s", buffer); return buffer;}
template <class T> ostream& operator << (ostream& o, const vector <T>& v) {o << "{"; FOREACH(it, v) o << *it << ","; return o << "}";}
template <class A, class B> ostream& operator << (ostream& o, const pair <A, B>& p) {o << "("; o << p.first << "," << p.second << ")"; return o;}

const bool DEBUG = true;
const double epsilon = 1e-8;
const int infinite  = 1000000000;
const LL infiniteLongLong = 1000000000000000000LL;
const LL MODULO = 1000000000 + 7;
const int aMaxN = 100 + 1, bMaxN = 100 + 1;
bool calculated[aMaxN][bMaxN];
long long memo[aMaxN][bMaxN];
long long comb[aMaxN][bMaxN];

long long recurse(vector <int>& v, int remaining, int idx) {
	if (idx == 9 && v[9] <= remaining)
		return 1;
	else {
		if (calculated[remaining][idx])
			return memo[remaining][idx];
		if (v[idx] > remaining) return 0;
		calculated[remaining][idx] = true;
		long long& result = memo[remaining][idx] = 0;
		for (int i = v[idx]; i <= remaining; ++i)
			result = (result + comb[remaining][i] * recurse(v, remaining - i, idx + 1)) % MODULO;
		return result;
	}
}

long long calculate(vector <int>& v, int N) {
	long long result = 0;
	for (int i = 0; i < aMaxN; ++i)
		for (int j = 0; j < bMaxN; ++j)
			calculated[i][j] = false;
	for (int i = v[0]; i <= N; ++i) {
		result = (result + comb[N - 1][i] * recurse(v, N - i, 1)) % MODULO;
	}
	return result;
}

int solve(vector <int>& v, int N) {
	int minN = accumulate(v.begin(), v.end(), 0);
	for (int i = 0; i < aMaxN; ++i)
		for (int j = 0; j < bMaxN; ++j)
			comb[i][j] = 0;
	for (int i = 0; i < aMaxN; ++i)
		comb[i][0] = 1;
	for (int n = 1; n < aMaxN; ++n)
		for (int k = 1; k <= n; ++k)
			comb[n][k] = (comb[n - 1][k] + comb[n - 1][k - 1]) % MODULO;
	long long result = 0;
	for (int n = minN; n <= N; ++n) {
		result = (result + calculate(v, n)) % MODULO;
	}
	return result;
}

int main()
{
	const bool contest = true;
	int N = readInt();
	vector <int> v;
	for (int i = 0; i < 10; ++i)
		v.push_back(readInt());
	int result = solve(v, N);
	printf("%d\n", result);
	return 0;
}

// Powered by PhoenixAI

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int N = 3e5 + 5;
const int MAXN = 1e5 + 5;
const int M = 1e5;
const int mod = 1e9 + 7;
const int MOD = 1e9 + 7;
const int INF = 1e15;
const int LG = 21;

int arr[N];
int brr[N];

int fact[N], invfact[N];
int n;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
	invfact[N-1]=modinv(fact[N-1]);
	for(int i=N-2;i>=0;i--)
	{
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
}

int nCr(int x, int y)
{
	if(y>x)
		return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=MOD;
	num*=invfact[x-y];
	num%=MOD;
	return num;
}

int DP[105][11];

int f(int idx, int no)
{
	if(idx == n)
	{
		return (brr[no] == 0);
	}
	if(no >= 10 or idx > n)
	{
		return 0;
	}
	int & ret = DP[idx][no];
	if(~ret) return ret;
	ret = 0;
	if(no == 0)
	{
		trace(arr[0], n);
		for(int i = arr[no]; i <= n; i++)
		{
			ret += nCr(n - 1, i) * f(idx + i, no + 1);
			ret %= mod;
		}
		return ret;
	}
	else
	{
		for(int i = arr[no]; i <= n; i++)
		{
			ret += nCr(n - idx, i) * f(idx + i, no + 1);
			ret %= mod;
		}
		return ret;
	}
}

void solve()
{
	precompute();
	int n;
	cin >> n;
	memset(DP, -1, sizeof(DP));
	for(int i = 0; i <= 9; i++)
	{
		cin >> arr[i];
		brr[i] = arr[i];
	}
	for(int i = 9; i >= 0; i--)
	{
		brr[i] += brr[i + 1];
	}
	int ret = 0;
	for(int i = 1; i <= n; i++)
	{
		memset(DP, -1, sizeof(DP));
		:: n = i;
		ret += f(0, 0);
		ret %= mod;
	}
	cout << ret << endl;
}

int32_t main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD int(1e9+7)
#define N 1000
ll fact[N];
inline ll powMod(ll a,ll b){
    if(b==0)    return 1;
    if(b%2!=0){
        return (a*powMod(a,b-1))%MOD;
    }
    else{
        ll tmp=powMod(a,b/2);
        return (tmp*tmp)%MOD;
    }
}
inline ll c(ll n,ll r){
    ll ap=fact[n];
    ll dan=(fact[n-r]*fact[r])%MOD;
    return (ap*powMod(dan,MOD-2))%MOD;
}
ll a[N];
ll dp[101][11];
inline ll f(ll l,ll i){
   // cout<<l<<" "<<i<<endl;
    if(i==10){
        if(l==0)
            return 1;
        else
            return 0;
    }
    ll ret=0;
    if(dp[l][i]!=-1)    return dp[l][i];

    for(ll j=a[i];j<=l;j++){
        if(i==0)
            ret+=f(l-j,i+1)*c(l-1,j);
        else
            ret+=(f(l-j,i+1)*c(l,j));
        ret%=MOD;
    }
 /*   if(ret<0){
        cout<<l<<" "<<i<<endl;
    }*/
    return dp[l][i]=ret;
}

int main(){
  //  cout<<powMod(4,2)<<endl;
    ios_base::sync_with_stdio(false);
    fact[0]=1;
    for(ll i=1;i<N;i++){
        fact[i]=fact[i-1]*i;
        fact[i]%=MOD;
    }
    ll n;
    cin>>n;
    for(ll i=0;i<=9;i++)   cin>>a[i];
    ll ans=0;
    memset(dp,-1,sizeof(dp));
    for(ll i=0;i<=n;i++){
        ans+=f(i,0);
        ans%=MOD;
    }
    cout<<ans<<endl;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<climits>
#include<vector>
#include<cstring>
#include<stack>

using namespace std;

#define REP(i,s,n)  for (int i=(s),_n=(n);i<=_n;i++)
#define FOR(i,s,n)  for (int i=(s),_n=(n);i<_n;i++)
#define REPD(i,e,s)  for (int i=(e),_s=(s);i>=_s;i--)
#define tr(container, it) \
	for (typeof(container.begin()) it=container.begin(); it!=container.end();it++)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define MP make_pair

typedef long long LL;

int mod=1000000007;

LL C[210][210];
void init() {
	for (int i=0;i<205;i++)
		C[i][0]=1;
	for (int i=1;i<205;i++) {
		for (int j=1;j<=i;j++)
			C[i][j]=(C[i-1][j] + C[i-1][j-1])%mod;
	}
}

int n;
int dp[110][12];
int ar[10];
int func(int cur,int len) {
	if (len==10) return cur==0;
	if (dp[cur][len]!=-1) return dp[cur][len];
	LL ans=0;
	for (int i=ar[len];i<=cur;i++) {
		LL val= (len==0)?C[cur-1][i]:C[cur][i];
		ans=(ans+func(cur-i,len+1)*val)%mod;
		//cout << dp[cur][len] << endl;
	}
	return dp[cur][len]=ans;
}

int main() {
	init();
	cin >> n;
	FOR(i,0,10) cin >> ar[i];
	int ans=0;
	memset(dp,-1,sizeof dp);
	REP(i,1,n) {
		ans=(ans+func(i,0))%mod;
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <vector>

using namespace std;

const int mod = 1000000007;

int powm(int x, int y) {
    if (y == 1)
        return x;
    int v = powm(x, y / 2);
    v = (1LL * v * v) % mod;
    if (y % 2) {
        v = (1LL * v * x) % mod;
    }

    return v;
}

int main() {
    int N; cin >> N;
    vector<int> A(10);

    for (auto &it:A)
        cin >> it;

    vector<int> fact(N + 1, 1), ifact(N + 1, 1);
    for (int i = 1; i <= N; ++i) {
        fact[i] = (1LL * fact[i - 1] * i) % mod;
        ifact[i] = powm(fact[i], mod - 2);
    }

    vector< vector<int> > dp(10, vector<int>(N + 1, 0));

    for (int i = A[1]; i <= N; ++i)
        dp[1][i] = 1;

    for (int i = 2; i <= 10; ++i) {
        for (int j = 0; j <= N; ++j)
            for (int k = A[i % 10]; k <= j - (i / 10); ++k) {
                int ways = fact[j - (i / 10)];
                ways  = (1LL * ways * ifact[k]) % mod;
                ways = (1LL * ways * ifact[(j - i / 10) - k]) % mod;
                dp[i % 10][j] = (dp[i % 10][j] + 1LL * dp[i - 1][j - k] * ways) % mod;
            }
    }

    int answer = 0;
    for (int i = 1; i <= N; ++i)
        answer = (answer + dp[0][i]) % mod;

    cout << answer;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;

typedef long long LL;

const int MAXN = 110;
const int MAXM = 10;
const int MO = 1000000007;

int f[2][MAXN];
int C[MAXN][MAXN];
int A[MAXM];
int n;

void pre()
{
  C[0][0] = 1;
  for (int i = 1; i < MAXN; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j)
      C[i][j] = ((LL)C[i-1][j] + C[i-1][j-1])%MO;
  }
}

void init()
{
  scanf("%d", &n);
  for (int i = 0; i < MAXM; ++i) scanf("%d", A + i);
}

void solve()
{
  int w = 0, tmp, sum = 0, res;
  f[w][0] = 1;

  for (int i = 1; i < MAXM; ++i) {
    memset(f[w^1], 0, sizeof(f[w^1]));
    for (int j = sum+A[i]; j <= n; ++j) {
      for (int l = A[i]; l <= j; ++l) {
	tmp = ((LL)C[j][l] * f[w][j-l])%MO;
	f[w^1][j] = ((LL)tmp + f[w^1][j])%MO;
      }
    }
    sum += A[i];
    w ^= 1;
  }

  res = 0;
  for (int i = sum + A[0]; i <= n; ++i) {
    for (int j = A[0]; j < i; ++j) {
      tmp = ((LL)C[i-1][j] * f[w][i-j])%MO;
      res = ((LL)tmp + res)%MO;
    }
  }

  cout << res << endl;
}

int main()
{
  pre();
  init();
  solve();
  return 0;
}

// in the name of god
// ...
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define int long long
#define all(x) x.begin(), x.end()
#define sz(X) ((int)X.size())
inline int in() {int32_t x; scanf("%d", &x); return x;}
const int mod = 1e9 + 7 , N = 1000 + 7;

int dp[N][N], c[N][N], a[N];

int32_t main() {
    int n = in();
    for (int i = 0; i <= 9; i++)
        a[i] = in();
    for (int i = 0; i < N; i++) {
        c[0][i] = 1;
        for (int k = 1; k <= i; k++)
            c[k][i] = (c[k][i-1] + c[k-1][i-1]) % mod;
    }
    int sigma = 0;
    dp[10][0] = 1;
    for (int i = 9; i >= 0; i--) {
        sigma += a[i];
        for (int j = sigma; j <= n; j++) {
            if(i)
                for (int k = a[i]; k <= j; k++)
                    (dp[i][j] += dp[i+1][j - k] * 1ll * c[k][j]) %= mod;
            else
                for (int k = a[i]; k < j; k++)
                    (dp[i][j] += dp[i+1][j - k] * 1ll * c[k][j-1]) %= mod;
        }

    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
        ans = (ans + dp[0][i]) % mod;

    ans = (ans + mod) % mod;
    cout << ans << endl;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cassert>
#include <fstream>
#include <map>
#include <cstring>
#include <numeric>
#include <ctype.h>
#define MOD  1000000009
#define MOD1 1000000007
#define exit return 0
#define N 155
#define inf 1000000000000000000LL
typedef long long ll;
#define exit return 0
#define PS system("pause")
#define S 100007
#define mx(a,b) a>b?a:b
#define R0(i,n) for (i = 0; i < n; i++)
#define R1(i,n) for (i = 1; i <= n; i++)
#define MS(a,x) memset(x, a, sizeof(x));
#define left v<<1
#define right left|1
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
using namespace std;
int n, i, j, k, m, q, r, b;
int f[N], dp[N][N], a[N];
double ways[N][N], maxW;
ll C[N][N];
int maximal, pas;
int main(){
	scanf("%d", &n);
	for (int i = 0; i < 10; i++)cin >> a[i];
	//0(i, n + 1)C[i][0] = 1;
	//R0(i, n + 1){ C[i][0] = 1;  R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1; }
	for (int i = 0; i <= n; i++){
		C[i][0] = 1;
		for (int j = 1; j <= i; j++){
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD1;
			//C[i][j] %= MOD1;
		}
	}
	for (int i = a[9]; i <= n; i++){
		dp[9][i] = 1;
	}
	for (int i = 8; i >= 1; i--){
		for (int j = a[i]; j <= n; j++){
			for (int k = a[i]; k <= j; k++){
				dp[i][j] = (dp[i][j] + C[j][k] * dp[i + 1][j - k]) % MOD1;
			}
		}
		for (int i = a[0]; i <= n; i += 1){
			for (int j = a[0]; j <= i; j++){
				pas += (C[i - 1][j] * dp[1][i - j]) % MOD1;
				//pas %= MOD1;
			}
		}
	}
	cout << pas << endl;
}

/*cin >> n;
R0(i, 10){
cin >> a[i];
}
R0(i, 10){
if (a[i]){
go = i; break;
}
}
R0(i, n + 1)C[i][0] = 1;
R1(i, n) R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1;
*/

/* Author : RISHAV GOYAL */

#include <bits/stdc++.h>

using namespace std;

#define LL long long int
#define UL unsigned long long int

#define imax INT_MAX
#define imin INT_MIN
#define LLmax LLONG_MAX
#define LLmin LLONG_MIN

#define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++)
#define rep(i,n) for(int i= int(1); i<= (int)n; i++)
#define FORd(i,a,b,d) for(int i=(int)a; i<= (int)b; i+=(int)d)

#define pr() printf("Reached here 1...\n");
#define pr1() printf("Reached here 2...\n");

#define CLR(a) memset(a,0,sizeof(a));
#define SET(a) memset(a,-1,sizeof(a));

#define str strlen
#define pb(x) push_back(x)
#define mp make_pair
#define ii pair<int,int>
#define gcd(a,b) __gcd(a,b)

#define mod int(1e9 +7)
#define MAX int(1e5 + 10)

#define si(a) scanf("%d",&a);

#define VI vector<int>
#define VL vector<LL>
#define VS vector<string>
#define VC vector<char>

LL powmod(LL a,int b,int n){LL rm=1;while (b){if (b % 2) { rm = (rm * a) % n; }a = (a * a) % n;b /= 2;}return rm;}

LL dp1[101][101]={0},dp[20][101]={0}, ncr[150][150]={0} ,invmod[110],invmod2[150], precomp[105][105];

int main()
{
	int n,a[110], t = 0;
	cin >> n;
	for (int i = 0; i < 10; ++i)
	{
		cin >> a[i];
		if(i) t += a[i];
	}

	for(int i=1;i<=102;++i){
		precomp[i][i] = i;
		for(int j=i+1;j<=102;++j){
			precomp[i][j] =  ( precomp[i][j-1] * j) % mod;
		}
	}

	LL denominator = 1;
	invmod[0] = powmod(1, mod - 2, mod);
	for(int i=1;i<=103;++i){
		denominator = (denominator * i ) % mod;
		invmod[i] = powmod(denominator, mod-2 , mod);
	}

	for(int i=1;i<=135;++i){
		invmod2[i] = powmod(i , mod-2, mod);
	}

	for(int i=a[1];i<=n;++i) dp[1][i] = 1 ;
	int sum = a[1];
	for(int i=2;i<=9;++i){
		for(int l=1;l<=n;++l){
			for(int j=a[i]; j<=l; ++j){

				if( l>j){
					// l-j, dp[l-j] * (l-j+1) * ... * (l) / j!
					LL v;
					if( j != 0){
						v = (dp[i-1][l-j] * precomp[l-j+1][l]) % mod;
						v = ( v * invmod[j] ) % mod;
					}
					else v = dp[i-1][l];

					dp[i][l] = (dp[i][l] + v) % mod ;
				}
				else if( l==j && !sum) dp[i][l] = (dp[i][l]+1) % mod;
			}
		}
		sum += a[i];
	}

	ncr[0][0] = 1 ;
	for(int i=1;i<=130;++i){
		ncr[i][0] = 1 ;
		for(int j=1;j<=i;++j){
			ncr[i][j] = ( ncr[i][j-1] * ( i - j + 1) ) % mod;
			ncr[i][j] = ( ncr[i][j] * invmod2[j] ) % mod;
		}
	}

	LL ways = 0;

	for(int lol=1;lol<=n;++lol){
		if( lol==1 && !t) {
			if( a[0] <=1 ) ways = 1;
		}
		for(int digits = 1; digits<=lol; ++digits ){ // (zeros+digits-1) C (digits-1)
			int zeros = lol - digits;
			if( zeros < a[0]) break;
			ways = (ways + (dp[9][digits] * ncr[zeros+digits-1][digits-1] ) % mod) % mod;
		}

	}
	cout << ways << endl;
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0, _##i = (n); i < _##i; ++i)
#define repi(i, a) for (__typeof((a).begin()) i = (a).begin(), _##i=(a).end(); i != _##i; ++i)

const int md = 1000000007;

void addmd(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}
void submd(int &a, int b) {
    a -= b;
    if (a < 0) a += md;
}
int multmd(int a, int b) {
    return (ll)a * b % md;
}

int bin[110][110];
int choose(int n, int k) {
    if (k < 0 || k > n) return 0;
    if (k == 0 || k == n) return 1;
    if (n == 0) return 1;
    int &res = bin[n][k];
    if (~res) return res;
    res = choose(n - 1, k - 1);
    addmd(res, choose(n - 1, k));
    return res;
}

int dp[110][11];
int need[10];
int getdp(int n, int i) {
    if (i == 10) return n == 0;
    int &res = dp[n][i];
    if (~res) return res;
    res = 0;
    rep (j, n + 1) {
        if (j >= need[i]) {
            addmd(res, getdp(n - j, i + 1) * choose(n, j));
        }
    }
    return res;
}

int main() {
//  freopen("a.in","r",stdin); freopen("a.out","w",stdout);
    memset(bin, -1, sizeof(bin));
    int n;
    cin >> n;
    rep (i, 10) cin >> need[i];
    memset(dp, -1, sizeof(dp));
    int t = 0;
    rep (i, n + 1) {
        addmd(t, getdp(i, 0));
    }
    memset(dp, -1, sizeof(dp));
    need[0]--;
    rep (i, n) {
        submd(t, getdp(i, 0));
    }
    cout << t;
}

//dij
#include <iostream>
#include <fstream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#define  N   301
#define  inf 0XFFFFFFF
#define  mod 1000000007
#define  ll long long
using namespace std;

//ofstream fo("out.txt");
//ifstream fi("in.txt");
//#define cout cout
//#define cin fi

int n,a[10],s[10];
ll dp[N][N];
bool f[N][N];
ll c[N][N];
ll dfs(int n,int now)
{
    ll ans=0;
    if(now>=1&&s[9]-s[now-1]>n)return 0;
    if(now==0&&s[9]>n) return 0;
    if(now==9)
    {
        return 1;
    }
    else if(now!=0)
    {
        for(int i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                ans+=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                if(ans>=mod)ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                if(dp[n-i][now+1]>=mod) dp[n-i][now+1]%=mod;
                ans+=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                f[n-i][now+1]=true;
                if(ans>=mod)ans%=mod;
            }
        }
        return ans;
    }
    else
    {
        for(int i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                ans+=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                if(ans>=mod)ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                if(dp[n-i][now+1]>=mod) dp[n-i][now+1]%=mod;
                ans+=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                f[n-i][now+1]=true;
                if(ans>=mod)ans%=mod;
            }
        }
        return ans;
    }
    return ans;
}
int main()
{
    int i,j;
    cin>>n;
    for(i=0;i<10;i++)
        cin>>a[i];
    for(i=0;i<N;i++)
    for(j=0;j<=i;j++)
    c[i][j]=1;
    for(i=0;i<N;i++)
    {
        for(j=1;j<i;j++)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            if(c[i][j]>=mod)c[i][j]%=mod;
        }
    }
    s[0]=a[0];
    for(i=1;i<10;i++)
        s[i]=s[i-1]+a[i];
    long long ans=0;
    for(i=s[9];i<=n;i++)
    {
        ans+=dfs(i,0);
        if(ans>=mod) ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>

const int N = 110;
const int moder = 1e9 + 7;

int fac[N], inv[N];
int a[N];

int powermod(int a, int exp){
	int ret = 1;
	for ( ; exp > 0; exp >>= 1){
		if (exp & 1){
			ret = 1ll * ret * a % moder;
		}
		a = 1ll * a * a % moder;
	}
	return ret;
}

int dp[N];

int calc(int n){
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;
	for (int i = 0; i < 10; ++ i){
		for (int j = N - 1; j >= 0; -- j){
			int x = dp[j];
			dp[j] = 0;
			for (int k = a[i]; k <= n; ++ k){
				if (j + k >= N) break;
				dp[j + k] = (dp[j + k] + 1ll * x * inv[k]) % moder;
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; ++ i){
		ans = (ans + 1ll * dp[i] * fac[i]) % moder;
	}
	return ans;
}

int main(){
	fac[0] = 1;
	for (int i = 1; i < N; ++ i){
		fac[i] = 1ll * fac[i - 1] * i % moder;
	}
	inv[N - 1] = powermod(fac[N - 1], moder - 2);
	for (int i = N - 1; i; -- i){
		inv[i - 1] = 1ll * inv[i] * i % moder;
	}
	int n;
	scanf("%d", &n);
	for (int i = 0; i < 10; ++ i){
		scanf("%d", &a[i]);
	}
	int ans = calc(n);
	if (a[0] > 0){
		-- a[0];
	}
	ans -= calc(n - 1);
	ans += ans < 0 ? moder : 0;
	printf("%d\n", ans);
	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cassert>
#include <fstream>
#include <map>
#include <cstring>
#include <numeric>
#include <ctype.h>
#define MOD  1000000009
#define MOD1 1000000007
#define exit return 0
#define N 1555
#define inf 1000000000000000000LL
typedef long long ll;
#define exit return 0
#define PS system("pause")
#define S 100007
#define mx(a,b) a>b?a:b
#define R0(i,n) for (i = 0; i < n; i++)
#define R1(i,n) for (i = 1; i <= n; i++)
#define MS(a,x) memset(x, a, sizeof(x));
#define left v<<1
#define right left|1
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
using namespace std;
int n, i, j, k, m, q, r, b;
int f[N], dp[N][N], a[N];
double ways[N][N], maxW;
ll C[N][N];
int maximal, pas;
int main(){
	scanf("%d", &n);
	R0(i, 10){
		scanf("%d", &a[i]);
	}
	R0(i, n + 1)C[i][0] = 1;
	//R0(i, n + 1){ C[i][0] = 1;  R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1; }
	for (int i = 0; i <= n; i++){
		C[i][0] = 1;
		for (int j = 1; j <= i; j++){
			C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
			C[i][j] %= MOD1;
		}
	}
	for (int i = a[9]; i <= n; i++){
		dp[9][i] = 1;
	}
	for (int i = 8; i >= 1; i--){
		for (int j = a[i]; j <= n; j++){
			for (int k = a[i]; k <= j; k++){
				dp[i][j] = (dp[i][j] + C[j][k] * dp[i + 1][j - k]) % MOD1;
			}
		}
	}
	for (int i = a[0]; i <= n; i += 1){
		for (int j = a[0]; j <= i; j++){
			pas += C[i - 1][j] * dp[1][i - j];
			pas %= MOD1;
		}
	}
	cout << pas << endl;
}

/*cin >> n;
R0(i, 10){
cin >> a[i];
}
R0(i, 10){
if (a[i]){
go = i; break;
}
}
R0(i, n + 1)C[i][0] = 1;
R1(i, n) R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1;
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
ll const M = 1e9 + 7;
int const N = 111;

ll C[N][N], f[N][10];
int a[10];

void init() {
	for (int i=0; i<N; ++i) {
		C[i][0] = C[i][i] = 1;
		for (int j=1; j<i; ++j) {
			C[i][j] = (C[i-1][j-1] + C[i-1][j]) % M;
		}
	}
}

int main() {
	init();
	int n;
	cin >> n;
	for (int i=0; i<10; ++i) cin >> a[i];
	for (int i=a[9]; i<=n; ++i) f[i][9] = 1;
	for (int j=8; j>=0; --j) {
		for (int i=a[j]; i<=n; ++i) {
			ll tot = 0;
			for (int k=a[j]; k<=i; ++k) {
				tot = (tot + C[i-!j][k] * f[i-k][j+1]) % M;
			}
			f[i][j] = tot;
		}
	}
	ll tot = 0;
	for (int i=0; i<=n; ++i) tot = (tot + f[i][0]) % M;
	cout << tot << endl;
	return 0;
}

#include <cstdio>

int dp[11][110], C[110][110];
int min_cnt[10], n;
int mod = 1000000007;

int main (void) {
  C[0][0] = 1;
  for (int i = 0; i < 105; i++) {
    for (int j = 0; j < 105; j++) {
      C[i + 1][j] = (C[i + 1][j] + C[i][j]) % mod;
      C[i + 1][j + 1] = (C[i + 1][j + 1] + C[i][j]) % mod;
    }
  }

  scanf ("%d", &n);
  for (int i = 0; i < 10; i++) {
    scanf ("%d", &min_cnt[i]);
  }

  dp[1][0] = 1;
  for (int c = 1; c < 10; c++) {
    for (int used_n = 0; used_n <= n; used_n++) {
      if (dp[c][used_n]) {
	for (int cn = min_cnt[c]; cn <= n - used_n; cn++) {
	  int add = ((long long)dp[c][used_n] * C[used_n + cn][cn]) % mod;
	  dp[c + 1][used_n + cn] = (dp[c + 1][used_n + cn] + add) % mod;
	}
      }
    }
  }

  int res = 0;
  for (int used_n = 0; used_n <= n; used_n++) {
    int cnt = dp[10][used_n];
    if (cnt) {
      for (int null_n = min_cnt[0]; null_n <= n - used_n; null_n++) {
	if (null_n + used_n) {
	  int add = 0;
	  if (null_n == 1 && used_n == 0) {
	    add = 1;
	  } else {
	    add = ((long long)cnt * C[used_n + null_n - 1][null_n]) % mod;
	  }
	  res = (res + add) % mod;
	}
      }
    }
  }

  printf ("%d\n", res);

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int cnt[10];
long long int dp1[128][10];
long long int dp2[128][10];
long long int ncr[128][128];

void buildNCR(){
	ncr[0][0] = 1;
	ncr[1][0] = ncr[1][1] = 1;
	for(int i=2;i<128;i++){
		ncr[i][0] = 1;
		for(int j=1;j<=i;j++) ncr[i][j] = (ncr[i-1][j-1]+ncr[i-1][j])%MOD;
	}
}

long long solve(int N,int idx,long long int dp[128][10]){
	if(idx == 10){
		if(N == 0) return 1;
		else return 0;
	}
	if(dp[N][idx] != -1) return dp[N][idx];
	long long int ways = 0;
	for(int i=cnt[idx];i<=N;i++){
		ways = (ways + ncr[N][i]*solve(N-i,idx+1,dp))%MOD;
	}
	//cout<<N<<" "<<idx<<" "<<ways<<endl;
	return dp[N][idx] = ways;
}

int main(){
	int N;cin>>N;
	for(int i=0;i<10;i++) cin>>cnt[i];
	for(int i=0;i<128;i++) for(int j=0;j<10;j++) dp1[i][j] = dp2[i][j] = -1;
	buildNCR();
	long long int ans = 0;
	for(int i=1;i<=N;i++) ans = (ans+solve(i,0,dp1))%MOD;
	if(cnt[0] != 0){
		cnt[0] -= 1;
		for(int i=1;i<=N;i++) ans = (ans+MOD-solve(i-1,0,dp2))%MOD;
	}
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>

#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
//#define ff fi.fi
//#define fs fi.se
//#define sf se.fi
//#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cerr << ">>>>>> " << #x << " -> " << x << endl
#define nani(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e2+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;

ll n,dp[10][MAX],x[MAX],fc[MAX],pre[MAX],ans;
bool st;

inline pw(ll x,ll y){
	ll ret = 1;
	while(y){
		if(y&1)ret = ret*x%MOD;
		x = x*x%MOD;
		y>>=1;
	}
	return ret;
}

ll f(int nw,int rem){
	if(nw==10)return rem==0;
	if(dp[nw][rem]!=-1)return dp[nw][rem];
	ll ret = 0;
	rep(i,x[nw],rem)ret = (ret + f(nw+1,rem-i)*pre[i])%MOD;
	return dp[nw][rem] = ret;
}

int main(){
//	cout<<fixed<<setprecision(10);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    fc[0] = pre[0] = 1;
    rep(i,1,100)fc[i] = fc[i-1] * i % MOD, pre[i] = pw(fc[i],MOD-2);
    cin>>n;
    rep(i,0,9)cin>>x[i];
    //case kalau 0
    ans = 1;
    rep(i,1,9)if(x[i])ans = 0;
    //first digit
    rep(i,1,9){
    	if(x[i])st = 1, --x[i];
    	else st = 0;
    	memset(dp,-1,sizeof dp);
    	rap(j,n-1,0)ans = (ans + f(0,j)*fc[j])%MOD;
    	if(st)x[i]++;
	}
	cout<<ans<<endl;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <utility>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define FOE(i,a,b) for (int i = (a); i <= (b); i++)
#define FR(i,e) for(__typeof(e.begin()) i = e.begin(); x != e.end(); i++)
#define SQR(x) ((x)*(x))
#define REP(i,n) FOR(i,0,n)
#define CLR(a,b) memset(a, b, sizeof(a))
#define INF (1<<29)
#define LL long long
#define PII pair<int,int>
#define PDI pair<double,int>
#define ISS istringstream
#define OSS ostringstream
#define gmin(a,b) { if ( b < a ) a = b; }
#define gmax(a,b) { if ( b > a ) a = b; }

#define MOD 1000000007

int a[11], n;
LL dp[11][111], c[111][111];

int main() {
  CLR( c, 0 );
  REP( i, 111 ) c[i][0] = 1;
  FOR( i, 1, 111 ) FOE( j, 1, i ) c[i][j] = ( c[i - 1][j - 1] + c[i - 1][j] ) % MOD;

  cin >> n;
  REP( i, 10 ) cin >> a[i];

  CLR( dp, 0 );

  int len = 0;
  for( int i = a[1]; i <= n; i++ ) dp[1][i] = 1;
  len = a[1];
  FOR( i, 2, 10 ) {
    for( int l = len + a[i]; l <= n; l++ ) {
      for( int j = a[i]; j <= l - len; j++ ) {
        dp[i][l] += dp[i - 1][l - j] * c[l][j] % MOD;
        dp[i][l] %= MOD;
      }
    }
    len += a[i];
  }

  LL ans = 0;
  for( int l = a[0] + len; l <= n; l++ ) {
    for( int i = a[0]; i <= n - len; i++ ) {
      int k = l - i;
      ans += dp[9][k] * c[l - 1][i] % MOD;
      ans %= MOD;
    }
  }

  cout << ans << endl;

  return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
using namespace std;

const int maxn=122;
const int mod=1000000007;
long long f[12][maxn];
int n;
int data[maxn];
long long c[maxn][maxn];

long long add(long long x, long long y)
{
    return ((x%mod + y%mod) %mod);
}

long long mul(long long x, long long y)
{
    return ((x%mod) * (y%mod) %mod);
}

int main()
{
    scanf("%d", &n);
    for(int i=0;i<10;++i)
        scanf("%d", &data[i]);

    for(int i=0;i<maxn;++i)
        c[i][0]=1;
    for(int i=1;i<maxn;++i)
        for(int j=1;j<=i;++j)
            c[i][j]=add(c[i-1][j], c[i-1][j-1]);

    f[10][0]=1;
    for(int i=9;i>=1;--i)
        for(int j=0;j<=n;++j)
            for(int k=0;k<=j-data[i];++k)
                f[i][j]=add(f[i][j], mul(f[i+1][k], c[j][k]));

    for(int j=0;j<=n;++j)
        for(int k=0;k<=j-data[0];++k)
            f[0][j]=add(f[0][j], mul(f[1][k], c[j-1][k-1]));

    long long ans=0;
    for(int i=0;i<=n;++i)
        ans=add(ans, f[0][i]);

    printf("%I64d\n", ans);

//    system("pause");
    return 0;
}

/* Author : RISHAV GOYAL */

#include <bits/stdc++.h>

using namespace std;

#define LL long long int
#define UL unsigned long long int

#define imax INT_MAX
#define imin INT_MIN
#define LLmax LLONG_MAX
#define LLmin LLONG_MIN

#define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++)
#define rep(i,n) for(int i= int(1); i<= (int)n; i++)
#define FORd(i,a,b,d) for(int i=(int)a; i<= (int)b; i+=(int)d)

#define pr() printf("Reached here 1...\n");
#define pr1() printf("Reached here 2...\n");

#define CLR(a) memset(a,0,sizeof(a));
#define SET(a) memset(a,-1,sizeof(a));

#define str strlen
#define pb(x) push_back(x)
#define mp make_pair
#define ii pair<int,int>
#define gcd(a,b) __gcd(a,b)

#define mod int(1e9 +7)
#define MAX int(1e5 + 10)

#define si(a) scanf("%d",&a);

#define VI vector<int>
#define VL vector<LL>
#define VS vector<string>
#define VC vector<char>

LL powmod(LL a,int b,int n){LL rm=1;while (b){if (b % 2) { rm = (rm * a) % n; }a = (a * a) % n;b /= 2;}return rm;}

LL dp1[101][101]={0},dp[20][101]={0}, ncr[150][150]={0} ,invmod[110],invmod2[150], precomp[105][105];

int main()
{
	int n,a[110], t = 0;
	cin >> n;
	for (int i = 0; i < 10; ++i)
	{
		cin >> a[i];
		if(i) t += a[i];
	}

	for(int i=1;i<=102;++i){
		precomp[i][i] = i;
		for(int j=i+1;j<=102;++j){
			precomp[i][j] =  ( precomp[i][j-1] * j) % mod;
		}
	}

	LL denominator = 1;
	invmod[0] = powmod(1, mod - 2, mod);
	for(int i=1;i<=103;++i){
		denominator = (denominator * i ) % mod;
		invmod[i] = powmod(denominator, mod-2 , mod);
	}

	for(int i=1;i<=135;++i){
		invmod2[i] = powmod(i , mod-2, mod);
	}

	for(int i=a[1];i<=n;++i) dp[1][i] = 1 ;
	int sum = a[1];
	for(int i=2;i<=9;++i){
		for(int l=1;l<=n;++l){
			for(int j=a[i]; j<=l; ++j){

				if( l>j){
					// l-j, dp[l-j] * (l-j+1) * ... * (l) / j!
					LL v;
					if( j != 0){
						v = (dp[i-1][l-j] * precomp[l-j+1][l]) % mod;
						v = ( v * invmod[j] ) % mod;
					}
					else v = dp[i-1][l];

					dp[i][l] = (dp[i][l] + v) % mod ;
				}
				else if( l==j && !sum) dp[i][l] = (dp[i][l]+1) % mod;
			}
		}
		sum += a[i];
	}

	ncr[0][0] = 1 ;
	for(int i=1;i<=130;++i){
		ncr[i][0] = 1 ;
		for(int j=1;j<=i;++j){
			ncr[i][j] = ( ncr[i][j-1] * ( i - j + 1) ) % mod;
			ncr[i][j] = ( ncr[i][j] * invmod2[j] ) % mod;
		}
	}

	LL ways = 0;

	for(int lol=1;lol<=n;++lol){
		if( lol==1 && !t) {
			if( a[0] <=1 ) ways = 1;
		}
		for(int digits = 1; digits<=lol; ++digits ){ // (zeros+digits-1) C (digits-1)
			int zeros = lol - digits;
			if( zeros < a[0]) break;
			ways = (ways + (dp[9][digits] * ncr[zeros+digits-1][digits-1] ) % mod) % mod;
		}

	}
	if(!t)ways--;
	cout << ways << endl;
	return 0;
}

#include <iostream>
#include <cstring>

using namespace std;

const int MOD = 1e9 + 7;

typedef long long ll;

ll dp[105][105];
void gen(){

    for(int i=0; i <= 100; i++){
        for(int j=0; j <= 100; j++)
        {
            if(j == 0 || j == i || i == 0)
                dp[i][j] = 1;
            else
                dp[i][j] = dp[i-1][j] + dp[i-1][j-1];

            dp[i][j] %= MOD;
        }
    }
}

int v[10];

ll solve(int length, int dig){

    if(dig == 9) return (v[dig] >= length);
    if(dp[length][dig] != -1) return dp[length][dig];

    long long ans = 0;

    if(dig == 0){

        for(int i = v[dig]; i <= length; i++)
        {

            ans += solve(length - i, 1) * dp[length - 1][i];
            ans %= MOD;
        }
    }else{

        for(int i = v[dig]; i <= length; i++){
            ans += solve(length - i, dig + 1) * dp[length][i];
            ans %= MOD;
        }
    }

    return dp[length][dig] = ans;

}

int main()
{
    gen();

    int n; cin >> n;

    int sum =0;

    for(int i = 0; i < 10; i++){
        cin >> v[i];
        sum += v[i];
    }

    long long ans = 0;

    memset(dp, -1, sizeof dp);

    for(int i = sum; i <= n ; i++){

        long long cur = solve(i, 0);
    //    cout << cur << endl;

        ans += cur;
        ans %= MOD;

    }

    cout << ans << endl;

    return 0;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<climits>
#include<vector>
#include<cstring>
#include<stack>

using namespace std;

#define REP(i,s,n)  for (int i=(s),_n=(n);i<=_n;i++)
#define FOR(i,s,n)  for (int i=(s),_n=(n);i<_n;i++)
#define REPD(i,e,s)  for (int i=(e),_s=(s);i>=_s;i--)
#define tr(container, it) \
	for (typeof(container.begin()) it=container.begin(); it!=container.end();it++)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define MP make_pair

typedef long long LL;

int main() {
	int n;
	cin >> n;
	if (n==1 || n==2) {
		cout << -1 << endl;
		return 0;
	}
	if (n==3) {
		cout << 210 << endl;
		return 0;
	}
	cout << 1;
	LL val=1;
	FOR(i,1,n) val=(val*10)%210;
	LL rem=210-val;
	if (rem<10) {
		FOR(i,1,n-1) cout << 0;
		cout << rem << endl;
		return 0;
	}
	if (rem<100) {
		FOR(i,1,n-2) cout << 0;
		cout << rem << endl;
		return 0;
	}
	FOR(i,1,n-3) cout << 0;
	cout << rem << endl;
	return 0;
}

#include <bits/stdc++.h>
#define mod 1000000007LL
#define MAX 1000000000
#define INF 10000000000000009LL
#define sz 109
#define offset 209
#define ull unsigned long long
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define ios ios::sync_with_stdio(false)
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
#define dbvv(v) cout << "Prlling "#v << " --> \n"; for(ll i=0;i<v.size();i++) {for(ll j=0;j<v[i].size();j++) cout << v[i][j] << " "; cout << "\n";}
#define dbv(st) cout << "Prlling "#st << " --> \n"; for(auto i=st.begin();i!=st.end();i++) cout << *i << " "; cout << "\n";
#define dbmp(mp) cout << "Prlling "#mp << " --> \n"; for(auto i=mp.begin();i!=mp.end();i++) cout << #mp"[" << i->first << "]"<< " = " << i->second << "\n";
template <typename Arg1>void ZZ(const char* name, Arg1&& arg1){std::cout << name << " = " << arg1 << std::endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    std::cout.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
using namespace std;

/*
##########################
## Author: Viral Mehta  ##
## College: BITS Pilani ##
##########################
*/
vector<ll> v(10),fact(sz);
ll dp[109][19],vis[109][19];
void compute_fact()
{
	ll i;
	fact[0]=1;
	for(i=1;i<sz;i++) fact[i]=(i*fact[i-1])%mod;
}
ll power(ll base,ll expo)
{
	if(base==0) return 0LL;
	if(expo==0) return 1LL;
	if((expo&1)==0)
	{
		ll z=power(base,(expo>>1));
		return(z*z)%mod;
	}
	return (base*power(base,expo-1))%mod;
}
ll nCr(ll a,ll b)
{
	if(b>a) return 0;
	ll den=(fact[b]*fact[a-b])%mod;
	ll num=fact[a];
	ll ret=(num*power(den,mod-2))%mod;
	return ret;
	//db(num,den,a,b,ret);
}
ll f(ll len,ll dig)
{
	//db(len,dig);
	if(dig==9)
	{
		if(len>=v[dig]) return 1LL;
		else return 0LL;
	}
	if(vis[len][dig]==1) return dp[len][dig];
	vis[len][dig]=1;
	ll i,ret=0;
	if(dig==0)
	{
		for(i=v[dig];i<=len;i++) ret=(ret+(f(len-i,1)*nCr(len-1,i)))%mod;
		//db(len,dig,ret);
		return dp[len][dig]=ret;
	}
	for(i=v[dig];i<=len;i++) ret=(ret+(f(len-i,dig+1)*nCr(len,i)))%mod;
	//db(len,dig,ret);
	return dp[len][dig]=ret;
}
int main()
{
	ios;
	compute_fact();
	ll n,i,ans=0,sm=0;
	cin>>n;
	for(i=0;i<10;i++) cin>>v[i],sm+=v[i];
	if(sm==0)
	{
		cout << power(10LL,n) << "\n";
		return 0;
	}
	//db(sm,n);
	for(i=sm;i<=n;i++) ans=(ans+f(i,0))%mod;
	cout << ans << "\n";
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long n,a[10],dp[2][169],fc[169],ifc[169],pwk,dv=1e9+7;

long long pw(long long x,long long y)
{
	if(!y)
	{
		return 1;
	}
	pwk=pw(x,y/2);
	pwk=pwk*pwk%dv;
	if(y%2)
	{
		pwk=pwk*x%dv;
	}
	return pwk;
}

long long cb(long long x,long long y)
{
	return fc[x]*ifc[y]%dv*ifc[x-y]%dv;
}

int main()
{
	long long i,j,r,ii,k,sm,z=0;

	scanf("%lld",&n);
	fc[0]=1;
	ifc[0]=1;
	for(i=1;i<=n;i++)
	{
		fc[i]=fc[i-1]*i%dv;
		ifc[i]=pw(fc[i],dv-2);
	}
	for(i=0;i<10;i++)
	{
		scanf("%lld",a+i);
	}
	for(ii=!!a[0];ii+1;ii--)
	{
		for(i=0;i<=n-ii;i++)
		{
			dp[0][i]=0;
		}
		dp[0][0]=1;
		sm=0;
		for(i=0;i<10;i++)
		{
			k=a[i]-(!i&&ii);
			for(j=0;j<=n-ii;j++)
			{
				dp[1][j]=0;
				for(r=k;r<=j;r++)
				{
					dp[1][j]=(dp[1][j]+dp[0][j-r]*cb(j,r))%dv;
				}
			}
			for(j=0;j<=n-ii;j++)
			{
				dp[0][j]=dp[1][j];
				if(i==9)
				{
					sm=(sm+dp[0][j])%dv;
				}
			}
		}
		z=(sm+dv-z)%dv;
	}
	printf("%lld\n",z);
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#define rank krevedka
#define ran rank
using namespace std;

const int mod = int(1e9) + 7;

int main()
{

    vector<int>z(10);
    vector<int>q(10);
    vector<int>p(10,0);
    int n;
    cin >>n;
    for(int i=0;i<10;i++)
        cin >>z[i];
    int s = 0;
    for(int i=0;i<10;i++)
        s+=z[i];
    if(s>n){cout <<0<<endl; return 0;}
    map<vector<int> ,int > m;
    int k=0;
    for(int i=1;i<10;i++)
    {
        if(z[i]==0){k++; continue;}
        q = z;
        q[i]--;
        sort(q.begin(),q.end());
        reverse(q.begin(),q.end());
        m[q]++;
    }
    sort(z.begin(),z.end());
    reverse(z.begin(),z.end());
    if(s!=n && k>0) m[z]+=k;
    long long res =0 ;
    while(--n)
    {
        res+=m[p];
        map<vector<int> ,int > temp;
        for(auto it = m.begin();it!=m.end();it++)
        {
            z = it->first;
            int s = 0;
            for(int i=0;i<10;i++)
                s+=z[i];
            int k = 0;
            for(int i=0;i<10;i++)
            {
                if(s>n) continue;
                if(i!=9 && z[i]==z[i+1]){k++; continue;}
                if(s==n && z[i]==0) break;
                if(z[i])
                {
                    z[i]--;
                    int &v = temp[z];
                    long long value = it->second; value*=k+1; value%=mod;
                    v = (v + value)%mod;
                    z[i]++;
                }else
                {
                    int &v = temp[z];
                    long long value = it->second; value*=k+1; value%=mod;
                    v = (v + value)%mod;
                }
            }
        }
        swap(temp,m);
    }
    res+=m[p];
    cout <<res%mod;
    return 0;
}
// lnufkoasjk

#include <iostream>
#include <fstream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#define  N   110
#define  inf 0XFFFFFFF
#define  mod 1000000007
//#define  long long
using namespace std;

//ofstream fo("out.txt");
//ifstream fi("in.txt");
//#define cout cout
//#define cin fi

long long  a[20],s[20];
long long  dp[N][N];
bool f[N][N];
long long  c[N][N];
long long  dfs(long long  n,long long  now)
{
    long long  ans=0;
    f[n][now]=true;
    if(now>=1&&s[9]-s[now-1]>n)return 0;
    if(now==0&&s[9]>n) return 0;
    if(now==9)
    {
        dp[n][now]=1;
        return 1;
    }
    else if(now!=0)
    {
        for(long long  i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                long long temp=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                temp%=mod;
                ans+=temp;
                ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                dp[n-i][now+1]%=mod;
                long long temp=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                temp%=mod;
                ans+=temp;
                f[n-i][now+1]=true;
                ans%=mod;
            }
        }
        ans%=mod;
        dp[n][now]=ans;
        return ans;
    }
    else
    {
        for(long long  i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                long long temp=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                temp%=mod;
                ans+=temp;
                ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                dp[n-i][now+1]%=mod;
                long long temp=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                temp%=mod;
                ans+=temp;
                f[n-i][now+1]=true;
                ans%=mod;
            }
        }
        ans%=mod;
        dp[n][now]=ans;
        return ans;
    }
    ans%=mod;
    dp[n][now]=ans;
    return ans;
}
int main()
{
    long long  i,j;
    long long n;
    cin>>n;
    memset(f,false,sizeof f);
    memset(dp,0,sizeof dp);
    memset(a,0,sizeof a);
    memset(s,0,sizeof s);
    for(i=0;i<10;i++)
        cin>>a[i];
    for(i=0;i<N;i++)
    {
        c[i][0]=c[i][i]=1;
        for(j=1;j<i;j++)
        {
            c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
            //if(c[i][j]>=mod)c[i][j]%=mod;
        }
    }
    s[0]=a[0];
    for(i=1;i<10;i++)
        s[i]=s[i-1]+a[i];
    long long ans=0;
    for(i=s[9];i<=n;i++)
    {
        ans+=(dfs(i,0)%mod);
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <set>
//#include <map>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cassert>
#define MAX 1000000000
#define mod 1000000007
#define eps 1e-10
using namespace std;
//Never lose hope~ For the dream

long long c[110][110];
long long a[110];
long long tmp[110];
long long dp[10][110];

long long gao(long long n)
{
    if(n==0)
    return 0;
    memset(dp,0,sizeof(dp));
    long long i,j,k;
    for(i=a[0];i<=n;i++)
    {
        dp[0][i]=c[n][i];
    }

    for(i=1;i<=9;i++)
    for(j=0;j<=n;j++)
    {
        for(k=a[i];k<=j;k++)
        {
            dp[i][j]=(dp[i][j]+dp[i-1][j-k]*c[n-(j-k)][k]%mod)%mod;
        }
    }

    /*for(i=0;i<=9;i++)
    {
    for(j=0;j<=n;j++)
    cout<<dp[i][j]<<" ";
    cout<<endl;
    }*/
    return dp[9][n]%mod;

}

int main()
{
    long long i,j,m,n;
    for(i=0;i<110;i++)
    for(j=0;j<110;j++)
    {
        if(j>i)
        {
        c[i][j]=0;
        continue;
        }
        if(j==0)
        c[i][j]=1;
        else
        c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
    }

    while(cin>>n)
    {
        m=0;
        for(i=0;i<=9;i++)
        {
            cin>>a[i];
            tmp[i]=a[i];
            m+=a[i];
        }
        if(m>n)
        {
            cout<<0<<endl;
            continue;
        }
        long long res=0;
        for(long long l=max(1LL,m);l<=n;l++)
        {

            for(i=0;i<=n;i++)
                a[i]=tmp[i];

            long long ans=gao(l);

            if(l==m&&a[0]==0)
            {
                res=(res+ans)%mod;
                continue;
            }
            //cout<<ans<<endl;
            if(a[0])
            a[0]--;
            ans-=gao(l-1);
            if(ans<0)
            ans+=mod;

            res=(res+ans)%mod;

        }

        cout<<res<<endl;
    }
    return 0;

}

#include <sstream>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <string.h>
using namespace std;
#define print1(a)    cout<<a<<endl
#define print2(a,b) cout<<a<<" "<<b<<endl
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define oo          (1<<30)
#define PI          3.141592653589793
#define pi          (2*acos(0))
#define ERR        1e-5
#define PRE        1e-8
#define SZ(s)      ((int)s.size())
#define LL           long long
#define ISS         istringstream
#define OSS        ostringstream
#define VS          vector<string>
#define VI          vector<int>
#define VD          vector<double>
#define VLL         vector<long long>
#define SII         set<int>::iterator
#define SI          set<int>
#define mem(a,b)    memset(a,b,sizeof(a))
#define fr(i,a,b)   for(i=a;i<=b;i++)
#define frn(i,a,b)  for(i=a;i>=b;i--)
#define fri(a,b)    for(i=a;i<=b;i++)
#define frin(a,b)   for(i=a;i>=b;i--)
#define frj(a,b)    for(j=a;j<=b;j++)
#define frjn(a,b)   for(j=a;j>=b;j--)
#define frk(a,b)    for(k=a;k<=b;k++)
#define frkn(a,b)   for(k=a;k>=b;k--)
#define frl(a,b)    for(l=a;l<=b;l++)
#define frln(a,b)   for(l=a;l>=b;l--)
#define EQ(a,b)     (fabs(a-b)<ERR)
#define all(a,b,c)  for(int I=0;I<b;I++)    a[I] = c
#define CROSS(a,b,c,d) ((b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y))
#define sqr(a)      ((a)*(a))
#define FORE(i,a)   for(typeof((a).begin())i=(a).begin();i!=(a).end();i++)
#define typing(j,b) typeof((b).begin()) j=(b).begin();
#define BE(a)       a.begin(),a.end()
#define rev(a)      reverse(BE(a));
#define sorta(a)    sort(BE(a))
#define pb          push_back
#define popb        pop_back
#define round(i,a)  i = ( a < 0 ) ? a - 0.5 : a + 0.5;
#define makeint(n,s)  istringstream(s)>>n
#define inpow(a,x,y) int i; a=x;fri(2,y)  a*=x
#define cntbit(mask) __builtin_popcount(mask)
#define mod         1000000007
#define mo 1001
long long comb[mo][mo];

void combination()
{
    int i,j;
    for(i=0;i<mo;i++)//let comb[0][0]=1
        comb[i][0]=1;
    comb[1][1]=1;
    for(i=2;i<mo;i++)
        for(j=1;j<mo;j++)
            comb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%mod;
    return ;
}
LL dp[20][20];//the digit,slot
LL arr[20];
int n;

LL dprec(int di,int rem)
{
   //print2(di,rem);
   LL &ret=dp[di][rem];
   if(ret!=-1) return ret;
   ret=0;
   if(rem==0)
   {
      if(di>9) return ret=1;
      if(arr[di]>rem) return ret;
      return ret=dprec(di+1,rem);
   }
   if(di>9) return ret;

   int i;
   for(i=max(0LL,arr[di]);i<=rem;i++)
      ret=(ret+(comb[rem][i]*dprec(di+1,rem-i))%mod)%mod;
   return ret;
}

int main()
{
   combination();
   while(cin>>n)
   {
      mem(dp,-1);
      int i;
      for(i=0;i<10;i++)
         cin>>arr[i];
      LL ans=0;
      for(i=1;i<=n;i++){
         ans=(ans+dprec(0,i))%mod;
         //print1(ans);
      }

      //print1(ans);
      arr[0]--;
      mem(dp,-1);
      for(i=0;i<n;i++)
         ans=(ans+mod-dprec(0,i))%mod;
      print1(ans);
   }
   return 0;
}

/*
3
1 0 0 0 0 0 0 0 0 1
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <map>
#include <string>
#include <sstream>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repf(i,k,n) for(int i=k;i<n;i++)

#define wl(c) cout<<c<<endl
#define wr(c) cout<<c
#define rd(c) cin>>c
#define va << " " <<

#define ll long long
#define M 1000000007

int n;
int* d;
int* cum;
int ii[10];

int pn[100];
map<string,ll> ht;

ll ss(int from,int len)
{
    stringstream cur;
    cur << from << " " << len;
    string str = cur.str();
    if (ht.count(str)>0) return ht[str];

    ll res = 0;
    if (from == 9)
    {
        if (len >= d[9]) return 1;
        else return 0;
    }
    if (from == 8 && len == 1)
    {
        int kk = 2;
        kk ++;
        from = from + 1 - 1;
    }

    for (ii[from]=d[from] ; ii[from]<= len-cum[from+1] ; ii[from] ++)
    {
        int l = len-ii[from];

        ll k = ss(from+1,l);

        rep(i,100) pn[i] = 0;
        for(int i = l+(from==0 ? 0 : 1) ; i <= l+ii[from]-1+(from==0 ? 0 : 1) ; i ++)
        {
            int a = 2 , m = i;
            while (m > 1)
            {
                while (m%a==0)
                {
                    pn[a]++;
                    m=m/a;
                }
                a++;
            }
        }
        for(int i = 1 ; i <= ii[from] ; i ++)
        {
            int a = 2 , m = i;
            while (m > 1)
            {
                while (m%a==0)
                {
                    pn[a]--;
                    m=m/a;
                }
                a++;
            }
        }
        ll z = 1;
        rep(i,100)
        {
            rep(j,pn[i]) z = (z * i) % M;
        }

        res = (res + (z*k)) % M;
    }

    //wl("("<<from<<","<<len<<") = "<<res);
    ht[str] = res;
    return res;
}

//#define cin inf
main()
{
    //ifstream inf("D:\\shuold move\\d&d 12\\My Documents\\consol programming\\in.txt");

    rd(n);
    d = new int[10];
    rep(i,10) rd(d[i]);
    cum = new int[11];
    cum[10] = 0;
    cum[9] = d[9];
    for(int i = 8; i >= 0 ; i --) cum[i] = cum[i+1] + d[i];

    ll all = 0;
    for (int l = cum[0] ; l <= n ; l ++)
        all += ss(0,l);
    wl(all);
}

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const int mod = 1e9 + 7;
const int MaxN = 1e2;

int cnt[10];
ll cnk[MaxN + 1][MaxN + 1];

ll getCNK (int n, int k) {
	if (cnk[n][k] != -1) return cnk[n][k];
	if (n == 0) {
		if (k == 0) return 1; else return 0;
	}
	if (n < k) return 0;
	return cnk[n][k] = (getCNK(n - 1, k) + getCNK(n - 1, k - 1)) % mod;
}

int main () {
	for (int i = 0; i <= MaxN; i++)
		for (int j = 0; j <= MaxN; j++)
			cnk[i][j] = -1;
	int n;
	scanf ("%d", &n);
	int sm = 0;
	for (int i = 0; i < 10; i++) {
		scanf ("%d", &cnt[i]);
		sm += cnt[i];
	}
	if (sm > n || (cnt[0] == n && n != 1)) {
		printf ("0");
		return 0;
	}
	if (cnt[0] == 1 && n == 1) {
		printf ("1");
		return 0;
	}
	ll res = 0;

	for (int firstNum = 1; firstNum < 10; firstNum++) {
		bool dec = false;
		if (cnt[firstNum] > 0) {
			cnt[firstNum]--;
			dec = true;
		}
		n--;

		ll curRes = 1;
		int left = n;
		for (int i = 0; i < 10; i++) {
			curRes = (curRes * getCNK(left, cnt[i]));
			left -= cnt[i];
		}

		for (int i = 0; i < left; i++)
			curRes = (curRes * 10) % mod;

		res = (res + curRes) % mod;

		n++;
		if (dec)
			cnt[firstNum]++;
	}
	printf ("%lld", res);
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=105;
const int Mod=1e9+7;
int n, kq[20][N], dp[N][N], a[N];
main()
{
	cin>>n;
	for(int i=0; i<=9; i++)cin>>a[i];
	for(int i=0; i<=n; i++)
		for(int j=0; j<=n; j++)dp[j][i]=(i==j || j==0) ? 1 : (dp[j-1][i-1] + dp[j][i-1]) % Mod;
	for(int i=a[9]; i<=n; i++)kq[9][i]=1;
	for(int i=8; i>=0; i--)
		for(int sl=a[i]; sl<=n; sl++)
			for(int x=a[i]; x<=sl; x++)
				kq[i][sl]= (kq[i][sl] + kq[i+1][sl-x] * dp[x][sl]) % Mod;
	for(int i=2; i<=n; i++)kq[0][i]=(kq[0][i] + kq[0][i-1])%Mod;
	cout<<kq[0][n];
}

#include <iostream>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

int tamano(int a) {
	int i = 0;
	while (a > 0) {
		a = a / 10;
		i++;
	}
	return i;
}

int main() {
	int a[10];
	int n;
	vector <int> a2;
	vector <int> a2aux;
	cin >> n;
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
		cout << endl;
		if(a[i]==1) a2.push_back(i);
	}

	int aux;
	int aux2;
	int tam = n;
	int contadoraux = 0;;

	int contador = 0;

	for (int i = 1; i < pow(10, tam); i++) {
		contadoraux = 0;
		a2aux = a2;
		if (tamano(i) <= tam) {
			aux = i;
			aux2 = i;
			while (aux2 > 0) {
				aux = aux2 % 10;
				for (int e = 0; e < a2aux.size(); e++) {
					if (aux == a2aux[e]) {
						contadoraux++;
						a2aux.erase(a2aux.begin()+e);
						break;
					}
				}
				aux2 = aux2 / 10;

			}
			if (contadoraux == a2.size()) {
				contador++;
			}

		}
	}

	cout << contador;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

typedef long long int ll;
int a[10];
ll DP[101][10];
ll silnie[102];
void prep_sil()
{
	silnie[0] = 1;
	for(int i = 1;i <= 100;++i)
		silnie[i] = (silnie[i - 1] *(ll)i) % MOD;
}
ll potmod(ll a,ll b)
{
	return !b ? 1 : !(b % 2) ? potmod((a * a) % MOD,b / 2) : (a * potmod((a * a) % MOD, b / 2)) % MOD;
}
ll C(int n,int k)
{
	if(!k) return 1;
	ll A = silnie[n];
	ll B = (silnie[k] * silnie[n - k]) % MOD;
	return (A * potmod(B,MOD - 2)) % MOD;
}
int main()
{
	int n;

	scanf("%d",&n);
	prep_sil();
	for(int i = 0;i < 10;++i) scanf("%d",&a[i]);

	for(int i = a[9];i <= n;++i) DP[i][9] = 1;
	for(int c = 8;c > 0;--c)
	{
		for(int dl = 0;dl <= n;++dl)
		{
			for(int i = a[c];i <= dl;++i)
			{
				DP[dl][c] = (DP[dl][c] + (DP[dl - i][c + 1] * C(dl,i) )) % MOD;
			}
		}
	}
	ll wyn = 0;
	for(int dl = 0;dl <= n;++dl)
	{
		for(int i = a[0];i <= dl;++i)
		{
			DP[dl][0] = DP[dl][0] + DP[dl - i][1] * C(dl - 1,i);
		}
		wyn += DP[dl][0];
		wyn %= MOD;
	}
	cout << wyn;
	return 0;
}

#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=a;i<=b;i++)
#define FD(i,a,b) for(int i=a;i>=b;i--)

#define LL long long
#define PI 3.14159265358979

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

#define mod 1000000007
int nCr[105][105];
int N,s[10],sum=0;
LL dp[10][105][2];
LL C(int a,int b){
    if(a<0 || b<0 || a<b) return 0;
    else return nCr[a][b];
}
int main(){
    FI(i,0,100) FI(j,0,i){
        if(j==0 || j==i) nCr[i][j]=1;
        else nCr[i][j]=(nCr[i-1][j]+nCr[i-1][j-1])%mod;
    }
    scanf("%d",&N);
    FI(i,0,9){
        scanf("%d",&s[i]);
        sum+=s[i];
    }
    if(sum>N){
        printf("0\n");
        return 0;
    }

    LL ans=0;

    FI(n,sum,N){
        memset(dp,0,sizeof(dp));
        FI(i,s[0],n-1) dp[0][i][0]=C(n-1,i);
        FI(i,1,9){
            FI(j,s[i],n){
                FI(k,0,j-s[i]){
                    dp[i][j][0]=(dp[i][j][0]+dp[i-1][k][0]*C(n-k-1,j-k))%mod;
                    dp[i][j][1]=(dp[i][j][1]+dp[i-1][k][0]*C(n-k-1,j-k-1)+dp[i-1][k][1]*C(n-k,j-k))%mod;
                }
            }
        }
        ans+=dp[9][n][1];
    }
    LL cur=1;
    FI(i,1,9) if(s[i]) cur=0;
    printf("%lld\n",(ans+cur)%mod);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long n,a[10],dp[2][169],fc[169],ifc[169],pwk,dv=1e9+7;

long long pw(long long x,long long y)
{
	if(!y)
	{
		return 1;
	}
	pwk=pw(x,y/2);
	pwk=pwk*pwk%dv;
	if(y%2)
	{
		pwk=pwk*x%dv;
	}
	return pwk;
}

long long cb(long long x,long long y)
{
	return fc[x]*ifc[y]%dv*ifc[x-y]%dv;
}

int main()
{
	long long i,j,r,ii,k,sm,z=0;

	scanf("%lld",&n);
	fc[0]=1;
	ifc[0]=1;
	for(i=1;i<=n;i++)
	{
		fc[i]=fc[i-1]*i%dv;
		ifc[i]=pw(fc[i],dv-2);
	}
	for(i=0;i<10;i++)
	{
		scanf("%lld",a+i);
	}
	for(ii=1;ii+1;ii--)
	{
		for(i=0;i<=n-ii;i++)
		{
			dp[0][i]=0;
		}
		dp[0][0]=1;
		sm=0;
		for(i=0;i<10;i++)
		{
			k=max(a[i]-(!i&&ii),0ll);
			for(j=0;j<=n-ii;j++)
			{
				dp[1][j]=0;
				for(r=k;r<=j;r++)
				{
					dp[1][j]=(dp[1][j]+dp[0][j-r]*cb(j,r))%dv;
				}
			}
			for(j=0;j<=n-ii;j++)
			{
				dp[0][j]=dp[1][j];
				if(i==9)
				{
					sm=(sm+dp[0][j])%dv;
				}
			}
		}
		z=(sm+dv-z)%dv;
	}
	printf("%lld\n",z);
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define present(c,val) ((c).find(val) != (c).end())
#define cpresent(c,val) (find(all(c),val) != (c).end())
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, x, y) for(int i= (x); i<= (y); ++i)
#define FORR(i, y, x) for(int i= (y); i>= (x); --i)

#define imax numeric_limits<int>::max()
#define imin numeric_limits<int>::min()
#define lmax numeric_limits<ll>::max()
#define lmin numeric_limits<ll>::min()
#define debug(var) cerr<<#var<<" = "<<(var)<<endl;
#define debugarr(var,n) cerr<<#var<<" = { ";rep(i,n) cerr<<var[i]<<" ";cerr<<"}"<<endl;
#define debugmat(var,m,n) cerr<<#var<<" = \n";rep(i,m) {rep(j,n) cerr<<var[i][j]<<" ";cerr<<endl;}
#define sci(var) scanf("%d",&(var))
#define scll(var) scanf("%lld",&(var))
#define MOD ((int)1e9+7)

int n,a[10],inv[105];
ll dp[105][10];

ll power(ll num, ll h) {
	if(!num) return 0;
	if(h==0) return 1;
	ll ans= power(num,h/2);
	if(h%2) return ((ans*ans)%MOD*num)%MOD;
	return (ans*ans)%MOD;
}

ll C(ll a, ll b) {
	if(!b) return 1;
	if(b>a) return 0;
	b=min(b,a-b);
	ll ans=1;
	ll b1=b;
	while(b--) ans=(ans*inv[b+1])%MOD;
	while(b1--) ans=(ans*(a--))%MOD;
	return ans;
}

void get(int ind, int digit) {
	if(dp[ind][digit]!=-1) return;
	if(digit==9) {
		dp[ind][digit]= ind>=a[9] ? 1 : 0;
		return;
	}
	dp[ind][digit]=0;
	for(int l=a[digit];l<=ind;l++) {
		get(ind-l,digit+1);
		if(digit) dp[ind][digit]=( dp[ind][digit]+ ( dp[ind-l][digit+1] * C(ind,l) )%MOD ) %MOD;
		else dp[ind][digit]=(dp[ind][digit]+(dp[ind-l][digit+1]*C(ind-1,l))%MOD ) %MOD;
	}
	return ;
}

int main() {
	cin>>n;
	int sm=0,ans=0;
	rep(i,10) cin>>a[i],sm+=a[i];
	inv[1]=1;
	FOR(i,2,102) inv[i]=power(i,MOD-2);
	if(sm>n) {cout<<0<<endl;return 0;}
	memset(dp,-1,sizeof dp);
	FOR(i,sm,n) {get(i,0);ans=(ans+dp[i][0])%MOD;}
	cout<<ans<<endl;
	return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

#define inf 0x7FFFFFFF

#define wrn cout << '\n'
#define wrs(s) cout << s
#define wrv(x) cout << x << '\n'
#define wra(v, x, y) for(int index = x; index <= y; ++ index) cout << v[index] << ' '
#define reset(v) memset(v, 0, sizeof(v))

using namespace std;

#define NLen 0x80
#define CLen 0x10
#define mod 1000000007

int a[CLen];
int dp[NLen][CLen];
int Comb[NLen][NLen];

int main()
{
    /* Always comment the next 2 lines */
// freopen("fi", "r", stdin);
// freopen("fo", "w", stdout);
    /* -------------- COMMENT --------------- */

    int N;

    cin >> N;
    for(int i = 0; i < 10; ++ i) scanf("%d", a + i);

    int MinLen = 0;
    for(int i = 0; i < 10; ++ i)
        MinLen += a[i];

    if(MinLen > N)
    {
        wrs("0");
        return 0;
    }

    reset(dp);
    reset(Comb);

    Comb[0][0] = 1;
    for(int n = 1; n <= N; ++ n)
    {
        Comb[n][0] = 1;
        Comb[n][n] = 1;
        for(int k = 1; k < n; ++ k)
            Comb[n][k] = (Comb[n - 1][k] + Comb[n - 1][k - 1]) % mod;
    }

    for(int len = a[9]; len <= N; ++ len) dp[len][9] = 1;

    for(int i = 8; i > 0; -- i)
        for(int len = a[i]; len <= N; ++ len)
            for(int j = a[i]; j <= len; ++ j)
                dp[len][i] = (dp[len][i] + ((long long)dp[len - j][i + 1] * Comb[len][j]) % mod) % mod;

    for(int len = a[0]; len <= N; ++ len)
        for(int j = a[0]; j <= len; ++ j)
            dp[len][0] = (dp[len][0] + ((long long)dp[len - j][1] * Comb[len - 1][j]) % mod) % mod;

    int Ans = 0;
    for(; MinLen <= N; ++ MinLen) Ans = (Ans + dp[MinLen][0]) % mod;

    wrv(Ans);

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second

int dx[]={0, 0, 1, -1};
int dy[]={1, -1, 0, 0};

typedef pair<int, int> pii;
typedef long long INT;

template <class T> inline void smin(T &a, T b) {if (a>b) a=b;}
template <class T> inline void smax(T &a, T b) {if (a<b) a=b;}
#define NN 111
#define mod 1000000007

int a[11], b[11], s[11];

INT C[NN][NN], best[NN][NN];

int pre() {
	int i, j;
	for (i=0; i<=100; i++) {
		for (j=0; j<=i; j++) {
			if (j==0 || i==j) C[i][j]=1;
			else C[i][j]=C[i-1][j-1]+C[i-1][j];
			C[i][j]%=mod;
		}
	}

}

INT calc(int len, int *a) {
	int i, j, k, cnt=0;

	for (i=0; i<10; i++) cnt+=a[i];
	if (len<cnt) return 0;
	if (len==0) return 1;

	memset(best, 0, sizeof(best));
	for (i=0; i<10; i++) {
		if (i==0) s[i]=a[i];
		else s[i]=s[i-1]+a[i];
	}

	for (i=1; i<=len; i++) for (j=0; j<10; j++) {
		for (k=a[j]; k<=i; k++) {
			if (j==0) {
				if (k==i) best[i][j]++;
			} else {
				if (i-k<s[j-1]) break;

				if (i>k) best[i][j]+=best[i-k][j-1]*C[i][k];
				else best[i][j]++;
				best[i][j]%=mod;
			}
		}

	}

	return best[len][9];
}

int main() {

	pre();

	int N, i;
	INT res;

	scanf("%d", &N);
	for (i=0; i<10; i++) scanf("%d", a+i);
	for (i=0; i<10; i++) b[i]=a[i];

	b[0]--; smax(b[0], 0);

	res=0;
	for (i=1; i<=N; i++) {
		res+=calc(i, a);
		res-=calc(i-1, b);
	}

	printf("%I64d\n", res);
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0, _##i = (n); i < _##i; ++i)
#define repi(i, a) for (__typeof((a).begin()) i = (a).begin(), _##i=(a).end(); i != _##i; ++i)

const int md = 1000000007;

void addmd(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}
void submd(int &a, int b) {
    a -= b;
    if (a < 0) a += md;
}
int multmd(int a, int b) {
    return (ll)a * b % md;
}

int bin[110][110];
int choose(int n, int k) {
    if (k < 0 || k > n) return 0;
    if (k == 0 || k == n) return 1;
    if (n == 0) return 1;
    int &res = bin[n][k];
    if (~res) return res;
    res = choose(n - 1, k - 1);
    addmd(res, choose(n - 1, k));
    return res;
}

int dp[110][11];
int need[10];
int getdp(int n, int i) {
    if (i == 10) return n == 0;
    int &res = dp[n][i];
    if (~res) return res;
    res = 0;
    rep (j, n + 1) {
        if (j >= need[i]) {
            addmd(res, getdp(n - j, i + 1) * choose(n, j));
        }
    }
    return res;
}

int main() {
//  freopen("a.in","r",stdin); freopen("a.out","w",stdout);
    memset(bin, -1, sizeof(bin));
    int n;
    cin >> n;
    rep (i, 10) cin >> need[i];
    memset(dp, -1, sizeof(dp));
    int t = 0;
    rep (i, n + 1) {
        addmd(t, getdp(i, 0));
    }
    memset(dp, -1, sizeof(dp));
    need[0]--;
    rep (i, n) {
        submd(t, getdp(i, 0));
    }
    cout << t;
}

// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 111
int C[ N ][ N ];
void build(){
  for( int i = 0 ; i < N ; i ++ )
    C[ i ][ 0 ] = C[ i ][ i ] = 1;
  for( int i = 2 ; i < N ; i ++ )
    for( int j = 1 ; j < i ; j ++ )
      C[ i ][ j ] = add( C[ i - 1 ][ j - 1 ] , C[ i - 1 ][ j ] );
}
int n , a[ N ];
void init(){
  n = getint();
  for( int i = 0 ; i < 10 ; i ++ )
    a[ i ] = getint();
}
int dp[ N ][ N ];
int cal( int len ){
  for( int i = 0 ; i <= 10 ; i ++ )
    for( int j = 0 ; j <= len ; j ++ )
      dp[ i ][ j ] = 0;
  dp[ 10 ][ 0 ] = 1;
  for( int i = 9 ; i >= 0 ; i -- )
    for( int j = 0 ; j <= len ; j ++ ){
      int pre = dp[ i + 1 ][ j ];
      if( pre == 0 ) continue;
      for( int jj = a[ i ] ; j + jj <= len ; jj ++ ){
        if( i or jj == 0 ){
          int tdp = mul( pre , C[ j + jj ][ jj ] );
          dp[ i ][ j + jj ] = add( dp[ i ][ j + jj ] , tdp );
        }else{
          int tdp = mul( pre , C[ j + jj - 1 ][ jj ] );
          dp[ i ][ j + jj ] = add( dp[ i ][ j + jj ] , tdp );
        }
      }
    }
  return dp[ 0 ][ len ];
}
void solve(){
  int tot = accumulate( a , a + 10 , 0 );
  if( tot > n ){
    puts( "0" );
    exit(0);
  }
  int ans = 0;
  for( int l = tot ; l <= n ; l ++ )
    ans = add( ans , cal( l ) );
  printf( "%d\n" , ans );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}

#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <complex>
#include <ctime>
#include <iomanip>
#include <cassert>
#include <sstream>
#include <iterator>

using namespace std;

#define file "file"
#define mp make_pair
#define pb push_back
#define xx real()
#define yy imag()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;

const int MAXN = 1e3 + 5;
const ll MOD = 1e9 + 7;

ll f[MAXN],fr[MAXN];
int a[20];
ll dp[MAXN][10];

ll bin_pow(ll a,ll st){
	ll ans = 1;
	for(;st;st >>= 1){
		if(st&1) ans = (ans * a + MOD) % MOD;
		a = (a * a + MOD) % MOD;
	}
	return ans;
}

void solve(){
	int n;
	scanf("%d",&n);
	f[0] = fr[0] = 1;
	for(int i = 1;i <= n;i++){
		f[i] = (f[i - 1] * i + MOD) % MOD;
		fr[i] = bin_pow(f[i], MOD - 2);
	}
	for(int i = 0;i < 10;i++){
		scanf("%d",&a[i]);
	}
	for(int len = 0;len <= n;len++){
		dp[len][9] = (a[9] <= len) ? 1 : 0;
		for(int c = 8;c >= 0;c--){
			dp[len][c] = 0;
			for(int k = a[c];k <= len;k++){
				int len2 = len;
				if(!c) len2--;
				ll cnk = (f[len2] * fr[k] + MOD) % MOD;
				if(len2 >= k) cnk = (cnk * fr[len2 - k] + MOD) % MOD;
				ll cur = (dp[len - k][c + 1] * cnk + MOD) % MOD;
				dp[len][c] = (dp[len][c] + cur + MOD) % MOD;
			}
		}
	}
	ll ans = 0;
	for(int i = 0;i <= n;i++){
		ans = (ans + dp[i][0] + MOD) % MOD;
	}
	cout << ans;
}

int main()
{
	//assert(freopen(file".in","r",stdin)); assert(freopen(file".out","w",stdout));
	#ifndef ONLINE_JUDGE
	assert(freopen("input.txt","r",stdin));
	assert(freopen("output.txt","w",stdout));
	#endif
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}

  //File Name: cf213B.cpp
  //Author: long
  //Mail: 736726758@qq.com
  //Created Time: 2016年02月18日 星期四 21时58分03秒

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>

#define LL long long

using namespace std;

const int MAXN = 105;
const int MOD = 1e9+7;

LL f[11][MAXN];
LL jie[MAXN];
int a[11];

void init(int n)
{
	jie[0] = 1LL;
	for(int i=1;i<=n;i++)
		jie[i] = jie[i-1] * i % MOD;
}

LL qp(LL x,LL y)
{
	LL res = 1LL;
	while(y){
		if(y & 1)
			res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

LL get(int i,int k,bool ok)
{
	if(k == 0)
		return 1;
	LL res = i;
	for(int j=1;j<k;j++)
		res = res * (i + j) % MOD;
	if(!ok)
		res = res * (i + k) % MOD;
	return res * qp(jie[k],MOD - 2) % MOD;
}

void solve(int n)
{
	init(n);
	a[10] = a[0];
	memset(f,0,sizeof f);
	int sum = 0;
	for(int i=a[1];i<=n;i++)
		f[1][i] = 1;
	for(int j=1;j<10;j++){
		sum += a[j];
		for(int i=sum;i<=n-a[j+1];i++){
			for(int k=a[j+1];i+k<=n;k++){
				(f[j+1][i+k] += f[j][i] * get(i,k,j+1 == 10) % MOD) %= MOD;
			}
		}
	}
	//for(int j=1;j<=10;j++){
	//	for(int i=1;i<=n;i++)
	//		printf("%d  ",f[j][i]);
	//	puts("");
	//}
	sum += a[10];
	LL ans = 0LL;
	for(int i=sum;i<=n;i++)
		ans = (ans + f[10][i]) % MOD;
	printf("%d\n",(int)ans);
	return ;
}

int main()
{
	int n;
	while(~scanf("%d",&n)){
		for(int i=0;i<10;i++){
			scanf("%d",&a[i]);
		}
		solve(n);
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;

#define mod 1000000007

int num[11];
int dp[11][105];
long long C[120][120];
void cal()
{
    C[1][1]=1;
    for(int i=0;i<101;i++)
        C[i][0]=1;
    for(int i=2;i<101;i++)
        for(int j=1;j<=i;j++)
        {
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
}
int main()
{
    cal();
    int n;
    scanf("%d",&n);
    for(int i=1;i<=10;i++)
        scanf("%d",num+i);
    long long sum=0;
    for(int z=0;z<=n;z++)
    {
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        for(int i=1;i<=10;i++)
            for(int j=num[i];j<=z;j++)
                for(int k=0;k+j<=z;k++)
                {
                    if(k==99)
                    {
                        int tt=0;
                    }
                    if(i!=1)
                        dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-k][j])%mod)%mod;
                    else
                    {
                        dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-1][j])%mod)%mod;
                    }
                }
        sum=(sum+dp[10][z])%mod;
    }
    printf("%I64d\n",sum);
    return 0;
}

// 017
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define MOD 1000000007
#define mod1 1187278649
#define mod2 1149736019
#define ioi cout<<"\n------------ioi------------\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

const ld PI=3.14159265358979323;
const int linf=1000111000111000111LL;
const int inf=1011111111;
const int N=105;
// global variables...
int freq[10], sum, dp[N][10], fac[N];

//functions...
int power(int x, int y, int p){
    int res=1;
    x=x%p;
    while(y>0)
    {
        if (y & 1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}

int modInverse(int n, int p){
    return power(n,p-2,p);
}

int nCrModPFermat(int n, int r, int p){
    if(r==0)
        return 1;
    return ((fac[n]*modInverse(fac[r],p))%p*modInverse(fac[n-r],p)%p)%p;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.txt", "r", stdin);
    //     freopen("outputf.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test=1;
    // cin>>test;
    fac[0]=1;
    for(int i=1;i<N;i++)
        fac[i]=(fac[i-1]*i)%MOD;
    while(test--){
        int n;
        cin>>n;
        sum=0;
        for(int i=0;i<10;i++){
            cin>>freq[i];
            sum+=freq[i];
        }
        if(n<sum){ // case where we do not have the answer.
            cout<<"0\n";
            continue;
        }
        // dp[i][j] => having a number of length 'i' using digits from 'j' till '9'.

        // So working with base cases i.e. dp[i][9] will be either 0 or 1 depending on value of freq[9].
        for(int i=1;i<=100;i++)
            if(i>=freq[9] and i<=n)
                dp[i][9]=1;
        if(freq[9]==0)
            dp[0][9]=1;

        // working for digits from 8 to 1.
        for(int i=8;i>=1;i--){
            for(int j=freq[i];j<=n;j++){
                int sum=0;
                for(int k=freq[i];k<=j;k++){
                    int ct1=dp[j-k][i+1]*nCrModPFermat(j,k,MOD);
                    ct1%=MOD;
                    sum=(sum+ct1)%MOD;
                }
                dp[j][i]=sum;
            }
        }
        for(int j=freq[0];j<=n;j++){
            int sum=0;
            for(int k=freq[0];k<=j;k++){
                int ct1=dp[j-k][1]*nCrModPFermat(j-1,k,MOD);
                ct1%=MOD;
                sum=(sum+ct1)%MOD;
            }
            dp[j][0]=sum;
        }
        // for(int i=0;i<=n;i++){
        //     for(int j=0;j<10;j++)
        //         cout<<dp[i][j]<<" ";
        //     cout<<endl;
        // }
        // ioi;
        int ans=0;
        for(int i=0;i<=n;i++)
            ans+=dp[i][0];
        cout<<ans;
    }
    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}

using namespace std;

#include<ios>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<numeric>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<deque>

#define FILES
#undef FILES
#ifdef FILES
#include<fstream>
ifstream cin("date.in");
ofstream cout("date.out");
#else
#include<iostream>
#endif

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ALL(a) a.begin(),a.end()
#define p_b(a) push_back(a)
#define m_p(a,b) make_pair(a,b)
#define p_p(a,b) p_b(m_p(a,b))

typedef unsigned char uchar;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef queue<int> qint;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<string> vstr;
typedef queue<int> qint;
typedef deque<int> dqint;
typedef deque<ll> dqll;
typedef map<string,int> mpstri;
typedef map<int,int> mpinti;
typedef map<string,string> mpstrs;
typedef map<string,vstr> mpstrvs;
const int INFI=~1;
const ll INFL=(1LL<<62);
const double eps=1e-7;
const long double pi=acos(-1.0);
const int md=1e9+7;

int main(){
    int co[101][101];

    for(int i=0;i<=100;i++)
        co[i][i]=co[i][0]=1;

    for(int i=2;i<=100;i++)
        for(int j=1;j<=i;j++)
            co[i][j]=(co[i-1][j]+co[i-1][j-1])%md;

    int n;
    int a[11];
    cin>>n;

    for(int i=0;i<10;i++)
        cin>>a[i];

    int dp[101][10]={};

    for(int i=0;i<10;i++)
        dp[0][i]=1;

    for(int i=a[9];i<=n;i++)
        dp[i][9]=1;

    for(int j=8;j>=1;j--)
        for(int le=1;le<=n;le++)
            for(int t=a[j];t<=n && le-t>=0;t++)
                dp[le][j]=(dp[le][j]+(dp[le-t][j+1]*co[le][t])%md)%md;

    for(int le=1;le<=n;le++)
        for(int t=a[0];t<=n && le-t>=0; t++)
            dp[le][0]=(dp[le][0]+(dp[le-t][1]*co[le-1][t])%md)%md;

    int s=0;
    for(int i=a[0];i<=n;i++)
        s=(s+dp[i][0])%md;

    cout<<s;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------head-------
const int N = 107;
const int MOD = 1e9 + 7;
int n, m, a[10], cnt[1 << 10], c[N][N];
void inc(int &x, int y) {
	x += y;
	if (x >= MOD)
		x -= MOD;
}
ll kpow(ll a, ll b) {
	ll r = 1;
	while (b > 0) {
		if (b & 1)
			r = r * a % MOD;
		a = a * a % MOD, b >>= 1;
	}
	return r;
}
void init() {
	rep(i, 1, 1 << 10)
		cnt[i] = 1 + cnt[i ^ (i & -i)];
	rep(i, 0, N) {
		c[i][0] = c[i][i] = 1;
		rep(j, 1, i)
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
	}
}
int solve(int n) {
	int ret = 0;
	rep(mask, 0, 1 << 10) {
		int tmp = 1, sum = 0;
		rep(i, 0, 10) {
			if (!(mask >> i & 1))
				continue;
			if (!a[i]) {
				tmp = 0;
				break;
			}
			tmp = 1ll * tmp * c[n - sum][a[i] - 1] % MOD;
			sum += a[i] - 1;
		}
		tmp = 1ll * tmp * kpow(10 - cnt[mask], n - sum) % MOD;
		if (cnt[mask] & 1)
			inc(ret, MOD - tmp);
		else
			inc(ret, tmp);
	}
//	printf("n = %d, ret = %d\n", n, ret);
	return ret;
}
int main() {
	init();
	scanf("%d", &n);
	rep(i, 0, 10) scanf("%d", a + i), m += a[i];
	int ans = 0;
	rep(i, 1, 10) {
		int flag = (a[i] > 0);
		a[i] -= flag;
		rep(j, m - flag, n)
			inc(ans, solve(j));
		a[i] += flag;
	}
	if (a[0] == 1 && a[0] == m)
		inc(ans, 1);
	printf("%d", ans);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<set>
using namespace std;

const int maxn = 100;
const int maxm = 100000;
const int INF = 1 << 30;
const double pi = acos(-1);
const int mod = (int)(1e9 + 7);

int dp[maxn + 10][20];
int n;
int a[20];
int com[200][200];

void init()
{
    memset(com, 0, sizeof(com));
    memset(dp, -1, sizeof(dp));
    for(int i = 1; i <= n; ++i)
    {
        com[i][0] = com[i][i] = 1;
        for(int j = 1; j < i; ++j)
        {
            com[i][j] = (com[i - 1][j] + com[i][ j - 1]) % mod;
           // cout << com[i][j] << endl;
        }
    }
}
int dfs(int len, int pos)
{
    if(pos == 10) return len == 0;
    if(len == 0) return 1;
    if(dp[len][pos] != -1) return dp[len][pos];
    dp[len][pos] = 0;

    for(int i = a[pos]; i <= len; ++i)
    {
        long long co;
        if(pos == 0) co = com[len - 1][i];
        else co = com[len][i];
       // cout << "pos = " << pos << endl;
       // cout << "len = " << len << ' ' << "i = " << i << endl;
        //cout << "co = " << co << endl;
        dp[len][pos] += (co * dfs(len - i, pos + 1)) % mod;
        //if(pos == 2) cout << dp[len][pos] << "===\n";
    }

    return dp[len][pos];
}
int main()
{
   // freopen("in.txt", "r", stdin);
    cin >> n;
    for(int i = 0; i < 10; ++i) cin >> a[i];
    init();
    long long res = 0;
    for(int i = 1; i <= n; ++i)
    {
        res += dfs(i, 0);
    }
    cout << res << endl;
    return 0;
}

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
using namespace std;
#define LL __int64
#define MOD 1000000007
#define MAXN 106
int D[10];
LL nCr[MAXN][MAXN], dp[MAXN][11];
bool vis[MAXN][11];
void gencom()
{
    int i,j;
    nCr[0][0] = 1;
    for (i=1; i<MAXN; ++i) nCr[i][0] = nCr[i][i] = 1, nCr[i][1] = i;
    for (i=2; i<MAXN; ++i)
    {
        for (j=2; j<i; ++j) nCr[i][j] = nCr[i-1][j] + nCr[i-1][j-1];
    }
}
LL bigmod(LL a, LL k)
{
    if (k==0) return 1;
    if (k%2) return (a*bigmod(a,k-1))%MOD;
    LL ret = bigmod(a,k/2);
    return (ret*ret)%MOD;
}
LL rec(int n, int d)
{
    if (d==10) return (n==0);
    if (n<D[d]) return 0;
    if (vis[n][d]) return dp[n][d];
    vis[n][d] = true;
    LL ret = 0;
    int i;
    for (i=D[d]; i<=n; ++i)
    {
        ret += (rec(n-i, d+1) * nCr[n][i])%MOD;
        ret %= MOD;
    }
    //printf("%d %d : %d\n",n,d,ret);
    return dp[n][d] = ret;
}
LL calc(int n)
{
    int d,f;
    LL ret = 0;
    while(n)
    {
        for (d=1; d<=9; ++d)
        {
            f = 0;
            if (D[d]) f = 1, --D[d];
            memset(vis, false, sizeof(vis));
            //printf("%d : %I64d\n", d, rec(n-1,0));
            ret += rec(n-1,0);
            ret %= MOD;
            D[d] += f;
        }
        --n;
    }
    return ret;
}
int main()
{
    gencom();
    int N,i;
    while(scanf("%d", &N) != EOF)
    {
        for (i=0; i<=9; ++i) scanf("%d", &D[i]);
        printf("%I64d\n", calc(N));
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

typedef long long int ll;
int a[10];
ll DP[101][10];
ll silnie[102];
void prep_sil()
{
	silnie[0] = 1;
	for(int i = 1;i <= 100;++i)
		silnie[i] = (silnie[i - 1] *(ll)i) % MOD;
}
ll potmod(ll a,ll b)
{
	return !b ? 1 : !(b % 2) ? potmod((a * a) % MOD,b / 2) : (a * potmod((a * a) % MOD, b / 2)) % MOD;
}
ll C(int n,int k)
{
	if(!k) return 1;
	ll A = silnie[n];
	ll B = (silnie[k] * silnie[n - k]) % MOD;
	return (A * potmod(B,MOD - 2)) % MOD;
}
int main()
{
	int n;
	scanf("%d",&n);
	prep_sil();
	for(int i = 0;i < 10;++i) scanf("%d",&a[i]);

	for(int i = a[9];i <= n;++i) DP[i][9] = 1;
	for(int c = 8;c > 0;--c)
	{
		for(int dl = 0;dl <= n;++dl)
		{
			for(int i = a[c];i <= dl;++i)
			{
				DP[dl][c] = (DP[dl][c] + (DP[dl - i][c + 1] * C(dl,i) )) % MOD;
			}
		}
	}
	ll wyn = 0;
	for(int dl = 0;dl <= n;++dl)
	{
		for(int i = a[0];i <= dl;++i)

			DP[dl][0] = (DP[dl][0] + DP[dl - i][1] * C(dl - 1,i)) % MOD;
		wyn += DP[dl][0];
		wyn %= MOD;
	}
	cout << wyn;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n;
const int sz=105;
int a[10];
long long m=1e9+7;
long long c[sz][sz];
long long dp[sz][12][12];

long long add(long long a,long long b){return (a%m+b%m)%m;}
long long mul(long long a,long long b){return (a%m*b%m)%m;}

long long solve(int l,int d,int f){
    long long &ret=dp[l][d][f];
    if(~ret) return ret;
    if(d==10) return ret=(!l);
    if(l<a[d]) return ret=0;
    ret=0;
    for(int cnt=a[d];cnt<=l;cnt++)
        ret=add(ret,mul(c[l][cnt],solve(l-cnt,d+1,f)));
    return ret;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<10;i++) scanf("%d",&a[i]);
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<=n;i++){
        c[i][0]=c[i][i]=1;
        for(int j=1;j<n;j++) c[i][j]=add(c[i-1][j],c[i-1][j-1]);
    }
    long long ans=0;
    for(int l=n;l>0;l--){
        for(int i=1;i<=9;i++){
            bool ok=0;
            if(a[i]){
                a[i]--;
                ok=1;
            }
            ans=add(ans,solve(l-1,0,i));
            if(ok) a[i]++;
        }
    }
    printf("%I64d",ans);
    return 0;
}

/*
 * DNumbers.cpp
 *
 *  Created on: Nov 17, 2012
 *      Author: piotrek
 */

#include<iostream>
#include<set>
#include<vector>
#include<map>

using namespace std;

const long long int MOD = 1000000007;
long long int res[103][10];
long long int a[10];

long long newton[105][105];

void comptNewton() {
  for (int n = 0; n < 103; n++) {
    newton[n][0] = 1;
    newton[n][n] = 1;
  }

  for (int n = 1; n < 103; n++) {
    for (int k = 1; k < n; k++) {
      newton[n][k] = (newton[n-1][k-1] + newton[n-1][k]) % MOD;
    }
  }

//  for (int n = 0; n < 8; n++) {
//    for (int k = 0; k <= n; k++) {
//      cout << newton[n][k] << " ";
//    }
//    cout << endl;
//  }
}

int main() {
  ios_base::sync_with_stdio(0);

  comptNewton();

  int n;
  cin >> n;
  for (int i = 0; i < 10; i++) {
    cin >> a[i];
  }

  for (int i = 0; i < 10; i++) {
    for (int k = 0; k < 103; k++) {
      res[i][k] = 0;
    }
  }

  int s = a[9];

  for (int k = s; k <= n; k++) {
    res[9][k] = 1;
  }

  for (int i = 8; i > 0; i--) {
    s += a[i];  // s - liczb zadanych cyfr
    for (int k = s; k <= n; k++) { // k - dlugosc liczby
      for (int additional = 0; additional + s <= k; additional++) { // additional -dodatkowe cyfry
        res[i][k] += newton[k][additional+a[i]]*res[i+1][k-additional-a[i]] % MOD;
        res[i][k] %= MOD;
      }
    }
  }

  s += a[0];
  for (int k = s; k <= n; k++) { // k - dlugosc liczby
    for (int additional = 0; additional + s <= k; additional++) { // additional -dodatkowe cyfry
      res[0][k] += newton[k-1][additional+a[0]]*res[1][k-additional-a[0]] % MOD;
      res[0][k] %= MOD;
    }
  }

  long long int r = 0;

  for (int i = 1; i <= n; i++) {
    r += res[0][i];
    r %= MOD;
  }

  cout << r << endl;

  return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

#define inf 0x7FFFFFFF

#define wrn cout << '\n'
#define wrs(s) cout << s
#define wrv(x) cout << x << '\n'
#define wra(v, x, y) for(int index = x; index <= y; ++ index) cout << v[index] << ' '
#define reset(v) memset(v, 0, sizeof(v))

using namespace std;

#define NLen 0x80
#define CLen 0x10
#define mod 1000000007

int a[CLen];
int dp[NLen][CLen];
int Comb[NLen][NLen];

int main()
{
    /* Always comment the next 2 lines */
//    freopen("fi", "r", stdin);
//    freopen("fo", "w", stdout);
    /* -------------- COMMENT --------------- */

    int N;

    cin >> N;
    for(int i = 0; i < 10; ++ i) scanf("%d", a + i);

    int MinLen = 0;
    for(int i = 0; i < 10; ++ i)
        MinLen += a[i];

    if(MinLen > N)
    {
        wrs("0");
        return 0;
    }

    reset(dp);
    reset(Comb);

    Comb[0][0] = 1;
    for(int n = 1; n <= N; ++ n)
    {
        Comb[n][0] = 1;
        Comb[n][n] = 1;
        for(int k = 1; k < n; ++ k)
            Comb[n][k] = (Comb[n][k - 1] * (n - k + 1)) / k;
    }

    for(int len = a[9]; len <= N; ++ len) dp[len][9] = 1;

    for(int i = 8; i > 0; -- i)
        for(int len = a[i]; len <= N; ++ len)
            for(int j = a[i]; j <= len; ++ j)
                dp[len][i] += dp[len - j][i + 1] * Comb[len][j];

    for(int len = a[0]; len <= N; ++ len)
        for(int j = a[0]; j <= len; ++ j)
            dp[len][0] += dp[len - j][1] * Comb[len - 1][j];

    int Ans = 0;
    for(; MinLen <= N; ++ MinLen) Ans += dp[MinLen][0];

    wrv(Ans);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
ULL gcd(LL a,LL b){return b==0?a:gcd(b,a%b);}
ULL lcm(LL a,LL b){return a*(1LL)*(b/(1LL*gcd(a,b)));}
int n;
int a[10];
ULL dp[105][15];
ULL fact[105];
ULL powr(int a,int b){
	if(b==0) return 1;
	if(b==1) return a;
	ULL t;
	t=powr(a,b/2);
	return b%2==0?(t*t)%MOD:((t*t)%MOD*a)%MOD;
}
void pre(){
	int i,j;
	fact[0]=1;
	rep(i,1,101) fact[i]=(fact[i-1]*i)%MOD;
}
ULL inversemod(ULL n){
	return powr(n,MOD-2);
}
ULL c(int n,int r){
	int i,j,k;
	return (fact[n]*(inversemod(fact[r])*inversemod(fact[n-r]))%MOD)%MOD;
}
ULL solve(int len,int j){
	if(dp[len][j]!=-1) return dp[len][j];
	int i,k;
	dp[len][j]=0;
	ULL ans=0;
	if(j==0) rep(i,a[0],len+1) ans=(ans+(solve(len-i,1)*c(len-1,i))%MOD)%MOD;
	if(j>0 && j<9) rep(i,a[j],len+1) ans=(ans+(solve(len-i,j+1)*c(len,i))%MOD)%MOD;
	if(j==9 && len>=a[9]) ans=1;
	return dp[len][j]=ans;
}
int main() {
	int i,j,k;
	pre();
	cin>>n;
	rep(i,0,10) cin>>a[i];
	mems(dp,-1);
	ULL ans=0;
	rep(i,1,n+1) ans=(ans+solve(i,0))%MOD;
	cout<<ans;
	return 0;
}

#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-9

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define sgn(x) (((x)>eps)-((x)<-eps))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

VI multiply(VI a, VI b, int n) {

	VI c(a.size()+b.size(), 0);

	for (int i=0; i<a.size(); i++) {

		for (int j=0; j<b.size(); j++) {

			c[i+j]=(c[i+j]+(INT)a[i]*b[j])%MOD;

		}

	}

	c.resize(n+1);

	return c;

}

const int NN = 222;

int a[NN], inv[NN], fac[NN];

int solve(int n) {

	VI c(n+1); c[0]=1;

	for (int i=0; i<10; i++) {

		VI b(n+1, 0);

		for (int j=a[i]; j<=n; j++) b[j]=inv[j];

		c=multiply(c, b, n);

	}

	int sum=0;

	for (int i=n>0; i<=n; i++) sum=(sum+(INT)c[i]*fac[i])%MOD;

	return sum;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n;

	gn(n);

	for (int i=0; i<10; i++) gn(a[i]);

	for (int i=fac[0]=1; i<NN; i++) fac[i]=(INT)fac[i-1]*i%MOD;

	inv[NN-1]=power(fac[NN-1], MOD-2, MOD);

	for (int i=NN-2; i>=0; i--) inv[i]=(INT)inv[i+1]*(i+1)%MOD;

	int ans=solve(n);

	if (a[0]) a[0]--;

	n--;

	ans=(ans+MOD-solve(n))%MOD;

	println(ans);

	return 0;

}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define i64 __int64
const i64 inf = 1000000007;
i64 c[110][110],d[110][11];
int sum,n,a[11],t[11];
void init()
{
    memset(c,0,sizeof(c));
    for(int i=0;i<105;++i) c[i][0]=1;
    for(int i=1;i<105;++i)
        for(int j=1;j<=i;++j)
            c[i][j]=(c[i-1][j-1]+c[i-1][j])%inf;
}
int ok()
{
    t[9]=a[9];
    for(int i=8;i>=0;--i)   t[i]=t[i+1]+a[i];
    sum=n-t[0];
    if(sum<0)   return -1;
    if(sum==0&&(t[0]==a[0])) return -1;
    return 1;
}
int zero()
{
    for(int i=1;i<10;++i)
        if(a[i])return 0;
    if(a[0]>1)  return 0;
    return 1;
}
i64 solve()
{
    memset(d,0,sizeof(d));
    for(int i=t[9];i<=sum+t[9];++i)   d[i][9]=1;
    for(int i=8;i>0;--i)
        for(int j=t[i];j<=sum+t[i];++j)
            for(int k=a[i];k<=sum+a[i];++k)if(j-k>=t[i+1])
                d[j][i]=(d[j][i]+d[j-k][i+1]*c[j][k])%inf;
    for(int j=t[0];j<=n;++j)
        for(int k=a[0];k<=sum+a[0];++k)if(j-k>=t[1])
            d[j][0]=(d[j][0]+d[j-k][1]*c[j-1][k])%inf;
    i64 res=0;
    for(int i=t[0];i<=n;++i)
        res=(res+d[i][0])%inf;
    return res;
}
int main()
{
    init();
    scanf("%d",&n);
    for(int i=0;i<10;++i)   scanf("%d",&a[i]);
    int ans=ok();
    if(ans<0)
        printf("0\n");
    else
        printf("%I64d\n",solve());
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long int M=1000000007;
long long int nCr[105][105];//(n,r)
long long int dp[105][10];//(len,i) numbers with length len using digits i...9
long long int a[10];
long long int powm(long long int x,long long int y)
{
	long long int r=1;
	while(y!=0)
	{
		if(y&1)
		{
			r=((r%M)*(x%M))%M;
		}
		x=((x%M)*(x%M))%M;
		y=y>>1;
	}
	return r%M;
}
void nCrcompute()
{
	long long int i,j;
	memset(nCr,0,sizeof(nCr));
	nCr[0][0]=1;
	for(i=1;i<=100;i++)
		for(j=0;j<=i;j++)
			if(j==0)
				nCr[i][j]=1;
			else
				nCr[i][j]=((nCr[i-1][j]%M)+(nCr[i-1][j-1]%M))%M;
}
long long int nCrf(long long int n,long long int r)
{
	if(n<r)
		return 0;
	if(n<0)
		return 0;
	if(r<0)
		return 0;
	return nCr[n][r]%M;
}
long long int rec(long long int len,long long int s)
{
	if(dp[len][s]!=-1)
		return dp[len][s]%M;
	else
	{
		long long int i,ret=0;
		if(s==0)
		{
			for(i=a[0];i<len;i++)
				ret=((ret%M)+((rec(len-i,s+1)%M)*(nCrf(len-1,i)%M))%M)%M;
			dp[len][s]=ret;
			//cout<<dp[len][s]<<' '<<len<<' '<<s<<'\n';
			return dp[len][s]%M;
		}
		else
		{
			for(i=a[s];i<=len;i++)
				ret=((ret%M)+((rec(len-i,s+1)%M)*(nCrf(len,i)%M))%M)%M;
			dp[len][s]=ret;
			//cout<<dp[len][s]<<' '<<len<<' '<<s<<'\n';
			return dp[len][s]%M;
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	nCrcompute();
	memset(dp,-1,sizeof(dp));
	long long int n,i,j,k;
	cin>>n;
	for(i=0;i<10;i++){
		cin>>a[i];
	}
	for(i=0;i<=n;i++){
		if(i>=a[9])
			dp[i][9]=1;
		else
			dp[i][9]=0;
	}
	long long int ans=0;
	for(i=n;i>0;i--)
		ans+=rec(i,0);
	cout<<ans<<'\n';
	return 0;
}

using namespace std;

#include<ios>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<numeric>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<deque>

#define FILES
#undef FILES

#ifdef FILES
#include<fstream>
ifstream cin("date.in");
ofstream cout("date.out");
#else
#include<iostream>
#endif

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ALL(a) a.begin(),a.end()
#define p_b(a) push_back(a)
#define m_p(a,b) make_pair(a,b)
#define p_p(a,b) p_b(m_p(a,b))

typedef unsigned char uchar;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef queue<int> qint;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<string> vstr;
typedef queue<int> qint;
typedef deque<int> dqint;
typedef deque<ll> dqll;
typedef map<string,int> mpstri;
typedef map<int,int> mpinti;
typedef map<string,string> mpstrs;
typedef map<string,vstr> mpstrvs;
const int INFI=~1;
const ll INFL=(1LL<<62);
const double eps=1e-7;
const long double pi=acos(-1.0);
const int md=1e9+7;

int main(){
    int co[101][101];

    for(int i=0;i<=100;i++)
        co[i][i]=co[i][0]=1;

    for(int i=2;i<=100;i++)
        for(int j=1;j<=i;j++)
            co[i][j]=(co[i-1][j]+co[i-1][j-1])%md;

    int n;
    int a[11];
    cin>>n;

    for(int i=0;i<10;i++)
        cin>>a[i];

    int dp[101][10]={};

    for(int i=a[9];i<=n;i++)
        dp[i][9]=1;

    for(int j=8;j>=1;j--)
        for(int le=0;le<=n;le++)
            for(int t=a[j];t<=n && le-t>=0;t++)
                dp[le][j]=(dp[le][j]+(dp[le-t][j+1]*co[le][t])%md)%md;

    for(int le=1;le<=n;le++)
        for(int t=a[0];t<=n && le-t>=0; t++)
            dp[le][0]=(dp[le][0]+(dp[le-t][1]*co[le-1][t])%md)%md;

    int s=0;
    for(int i=a[0];i<=n;i++)
        s=(s+dp[i][0])%md;

    cout<<s;

    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<unordered_map>
#include<ext/numeric>
using namespace std;
using namespace __gnu_cxx;

const int MD=int(1e9)+7;
int fct[101];
struct mul
{
    int operator()(int a,int b) const
    {
        return ((long long)a)*(b)%MD;
    }
};

int identity_element(mul m)
{
    return 1;
}
unordered_map<int,int> um;
int mdInv(int a)
{
    int &ret=um.insert({a,-1}).first->second;
    if(~ret)
        return ret;
    return ret=power(a,MD-2,mul());
}

int fact(int x)
{
    int &ret=fct[x];
    if(~ret)
        return ret;
    ret=1;
    for(int i=2;i<=x;i++)
    {
        ret=mul()(i,ret);
    }
    return ret;
}
int dp[100][10],n,a[10];
int len;
int swim(int rem,int d)
{
    if(d==10)
        if(rem==0)
            return fact(len);
        else
            return 0;
    int &r=dp[rem][d];
    if(~r)
        return r;
    r=0;
    for(int i=a[d];i<=rem;i++)
    {
        r=(r+mul()(mdInv(fact(i)),swim(rem-i,d+1)))%MD;
    }
    return r;
}

bool kolloZeros()
{
    for(int i=1;i<10;i++)
        if(a[i])
            return false;
    return true;
}

int main()
{
    //freopen("test.in","rt",stdin);
    memset(fct,-1,sizeof(fct));
    cin>>n;
    for(int i=0;i<10;i++)
        cin>>a[i];
    int res=0;

    for(int i=1;i<=n;i++)
    {
        len=i-1;
        for(int j=1;j<10;j++)
        {
            memset(dp,-1,sizeof(dp));
            if(a[j])
            {
                a[j]--;
                res=(res+swim(i-1,0))%MD;
                a[j]++;
            }
            else
                res=(res+swim(i-1,0))%MD;
        }
    }
    if(a[0]<=1&&kolloZeros())
        res=(res+1)%MD;
    cout<<res<<endl;
    return 0;
}

#include <bits/stdc++.h>

#define FOR(i,a,b) for( int i = (a); i < (int)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define PW(x) (1LL<<(x))
#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vi> mi;
typedef vector<vl> ml;
typedef vector<vd> md;

const int INF = 1e9+10;
const ll INFLL = 1e18+10;
const ld EPS = 1e-8;
const ld EPSLD = 1e-14;
const ll MOD = 1e9+7;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }

struct Mod{
  unsigned n;
  Mod(){}
  Mod( ll x ){
    if( x < 0 ) n = x%MOD+MOD;
    else n = x%MOD;
  }
};

Mod operator + ( Mod a  , Mod b ){ return Mod( a.n + b.n ); }
Mod operator +=( Mod &a , Mod b ){ return a = a + b; }
Mod operator - ( Mod a  , Mod b ){ return Mod( a.n + MOD - b.n ); }
Mod operator -=( Mod &a , Mod b ){ return a = a - b; }
Mod operator * ( Mod a  , Mod b ){ return Mod( (ll)a.n * b.n ); }
Mod operator *=( Mod &a , Mod b ){ return a = a * b; }
Mod modpow( Mod x , ll k ){
  Mod res = 1;
  while( k ){
    if( k & 1 ) res *= x;
    k /= 2;
    x *= x;
  }
  return res;
}
Mod inv( Mod a ){ return modpow( a , MOD-2 ); }
Mod operator / ( Mod a  , Mod b ){ return Mod( (ll)a.n * inv(b).n ); }
Mod operator /=( Mod &a , Mod b ){ return a = a / b; }

class Comb : public vector<vector<Mod> > {
 public:
  Comb( int max_n ){
    resize( max_n , vector<Mod>( max_n ) );
    REP( i , max_n ){
      at(i).at(0) = at(i).at(i) = 1;
      FOR( j , 1 , i )
	at(i).at(j) = at(i-1).at(j-1) + at(i-1).at(j);
    }
  }
};

const int MAX_N = 110;

int n;
int a[MAX_N];

Mod dp[MAX_N][MAX_N];

Comb C( MAX_N );

int main(){

  scanf( "%d" , &n );
  REP( i , 10 ) scanf( "%d" , &a[i] );

  FOR( i , a[9] , MAX_N ) dp[9][i] = 1;
  for( int i = 8; i > 0; i-- ){
    REP( j , MAX_N ) dp[i][j] = 0;
    FOR( j , a[i] , MAX_N ) FOR( k , a[i] , j+1 ){
      dp[i][j] += C[j][k] * dp[i+1][j-k];
    }
  }

  Mod ans = 0;
  FOR( j , 1 , n+1 ) FOR( k , a[0] , j+1 ){
    ans += C[j-1][k] * dp[1][j-k];
  }

  cout << ans.n << endl;

  return 0;
}

#include <algorithm>
#include <iostream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define endl '\n'
#define F first
#define S second
#define mp make_pair
#define ll long long
#define pb push_back
#define pii pair < int, int >
#define type(x) __typeof(x.begin())
#define foreach(i, x) for(type(x) i = x.begin(); i != x.end(); i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define sol (root << 1)
#define sag (sol | 1)
#define orta ((bas + son) >> 1)
#define bit __builtin_popcount

#ifndef D
	#define dbgs(x) 0
	#define dbg(x) 0
	#define TIME 0
#else
	#define dbgs(x) cerr << (#x) << " --> " << (x) << ' '
	#define dbg(x) cerr << (#x) << " --> " << (x) << endl
	#define TIME cerr << "Tooks " << (double) clock() / CLOCKS_PER_SEC << " seconds." << endl
#endif

const int inf = 1e9 + 5;
const ll linf = 1e18 + 5;

const int mod = 1e9 + 7;

const int N = 100 + 5;

const int M = 10;

int n, a[M], C[N][N], dp[M][N];

int f(int cur, int n) {

	if(cur == M)
		return !n;

	int &r = dp[cur][n];

	if(r != -1) return r;

	r = 0;

	FOR(i, a[cur], n)
		r = (r + f(cur + 1, n - i) * C[n][i] % mod) % mod;

	return r;

}

int main () {

    ios :: sync_with_stdio(0);

	memset(dp, -1, sizeof(dp));

	C[0][0] = 1;

	FOR(i, 1, N - 1)
	{
		C[i][0] = 1;

		FOR(j, 1, N - 1)
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
	}

	cin >> n;

	FOR(i, 0, 9)
		cin >> a[i];

	int st = a[0];

	int ans = 0;

	FOR(i, 1, n)
	{
		a[0] = st;

		memset(dp, -1, sizeof(dp));

		ans += f(0, i);

		if(a[0]) a[0]--;

		memset(dp, -1, sizeof(dp));

		ans -= f(0, i - 1);

		ans = (ans % mod + mod) % mod;
	}

	cout << ans << endl;

	return 0;

}

//dij
#include <iostream>
#include <fstream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#define  N   2001
#define  inf 0XFFFFFFF
#define  mod 1000000007
//#define  long long  long long
using namespace std;

//ofstream fo("out.txt");
//ifstream fi("in.txt");
//#define cout cout
//#define cin fi

long long  n,a[10],s[10];
long long  dp[N][N];
bool f[N][N];
long long  c[N][N];
long long  dfs(long long  n,long long  now)
{
    long long  ans=0;
    f[n][now]=true;
    if(now>=1&&s[9]-s[now-1]>n)return 0;
    if(now==0&&s[9]>n) return 0;
    if(now==9)
    {
        dp[n][now]=1;
        return 1;
    }
    else if(now!=0)
    {
        for(long long  i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                ans+=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                if(ans>=mod)ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                if(dp[n-i][now+1]>=mod) dp[n-i][now+1]%=mod;
                ans+=c[i+n-i+1-1][n-i+1-1]*dp[n-i][now+1];
                f[n-i][now+1]=true;
                if(ans>=mod)ans%=mod;
            }
        }
        dp[n][now]=ans;
        return ans;
    }
    else
    {
        for(long long  i=a[now];i<=n-s[9]+s[now];i++)
        {
            if(f[n-i][now+1])
            {
                ans+=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                if(ans>=mod)ans%=mod;
            }
            else
            {
                dp[n-i][now+1]=dfs(n-i,now+1);
                if(dp[n-i][now+1]>=mod) dp[n-i][now+1]%=mod;
                ans+=c[i+n-i-1][n-i-1]*dp[n-i][now+1];
                f[n-i][now+1]=true;
                if(ans>=mod)ans%=mod;
            }
        }
        dp[n][now]=ans;
        return ans;
    }
    dp[n][now]=ans;
    return ans;
}
int main()
{
    long long  i,j;
    cin>>n;
    memset(f,false,sizeof f);
    memset(dp,0,sizeof dp);
    memset(a,0,sizeof a);
    memset(s,0,sizeof s);
    for(i=0;i<10;i++)
        cin>>a[i];
    for(i=0;i<N;i++)
    for(j=0;j<=i;j++)
    c[i][j]=1;
    for(i=0;i<N;i++)
    {
        for(j=1;j<i;j++)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            if(c[i][j]>=mod)c[i][j]%=mod;
        }
    }
    s[0]=a[0];
    for(i=1;i<10;i++)
        s[i]=s[i-1]+a[i];
    long long ans=0;
    for(i=s[9];i<=n;i++)
    {
        memset(dp,0,sizeof dp);
        memset(f,false,sizeof f);
        ans+=dfs(i,0);
        if(ans>=mod) ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define stp setprecision(6)//use fixed before stp
#define endl '\n'
ll minv(ll x)
{
    ll y=mod-2;
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        res%=mod;
        y = y >> 1;
        x = x * x;
        x%=mod;
    }
    return res;
}
int main()
{
    FAST
    #ifndef ONLINE_JUDGE
        freopen("input.txt" , "rt" , stdin);
        freopen("output.txt" , "wt" , stdout);
    #endif
    ll n;
    cin>>n;
    ll a[10];
    for(ll i=0;i<10;i++)
    {
        cin>>a[i];
    }
    ll fac[101],inv[101];
    fac[1]=1;inv[1]=1;fac[0]=1;inv[0]=1;
    for(ll i=2;i<101;i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
        inv[i]=minv(fac[i]);
    }
    ll d[10][101];
    for(ll i=0;i<10;i++)
    {
        for(ll j=0;j<=100;j++)
        {
            d[i][j]=0;
        }
    }
    for(ll i=a[9];i<101;i++)
    {
        d[9][i]=1;
    }
    for(ll i=8;i>0;i--)
    {
        for(ll j=a[i];j<=100;j++)
        {
            for(ll k=0;k<=(100-j);k++)
            {
                d[i][j+k]+=d[i+1][k]*inv[j];
                d[i][j+k]%=mod;
            }
        }
    }
    ll zero[101][101];
    for(ll i=0;i<=100;i++)
    {
        for(ll j=0;j<=100;j++)
        {
            zero[i][j]=0;
        }
    }
    for(ll i=0;i<=100;i++)
    {
        for(ll j=0;j<=(100-i);j++)
        {
            zero[i][j]+=d[1][j]*inv[i];
            zero[i][j]%=mod;
        }
    }
    ll ans=0;
    for(ll i=a[0];i<=100;i++)
    {
        for(ll j=0;j<=(n-i);j++)
        {
            ans+=zero[i][j]*fac[j+i];
            ans%=mod;
            if(i>0)
                ans-=zero[i-1][j]*fac[j+i-1];
            ans%=mod;
            ans+=mod;
            ans%=mod;
        }
    }
    cout<<ans;
}

#include<limits>
#include<iostream>
#include<queue>
#include<climits>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<cstdlib>
using namespace std;

// ====================== BEGIN CUT HERE =========================

#define MOD 1000000007
#define m2(A,B) (((1LL*A)*B)%MOD)
#define m3(A,B,C) m2(m2(A,B),C)
#define m4(A,B,C,D) m2(m2(A,B),m2(B,C));
#define fix(A) (((A%MOD)+MOD)%MOD)
long long egcd(long long a,long long b)
{
    // a*px + b*py = gcd(a,b)
    long long x=0 , px = 1 , y = 1, py = 0;
    while(b != 0)
    {
        long long temp = b;
        long long q = a/b;
        b = a%b;
        a = temp;
        temp = x;
        x = px - q*x;
        px = temp;
        temp = y;
        y = py - q*y;
        py = temp;
    }
    //return a; // for gcd(a,b)
    //return px; // for egcd(a,MOD) [inverse multiplicative]
    return px;
}

long long divide(long long A,long long B)
{
    return (A*fix(egcd(B,MOD)))%MOD;
}
long long _facto[1000010];
void init_ncr(int N)
{
    _facto[0] = 1;
    for(int i = 1; i <= N; ++i)
        _facto[i] = (_facto[i-1]*1LL*i)%MOD;
}

// ====================== BEGIN CUT HERE =========================

int arr[10];
int memo[110][10];
int dp(int N,int D)
{
    if(D==-1)return N==0;
    if(N<arr[D])return 0;
    int w = 0;

    if(memo[N][D]!=-1)return memo[N][D];
    for(int i = arr[D]; i <= N; ++i)
    {
        long long fa = divide(_facto[N],_facto[N-i]);

        w = (w + 1LL * divide(fa,_facto[i]) * dp(N-i,D-1))%MOD;

//      if(D==P)cout <<" ---> "<<divide(fa,_facto[i]) << " x "<< dp(N-i,D-1) << endl;
    }
//  if(D==P)cout << endl;
    return memo[N][D] = w;
}

int main()
{
    init_ncr(200);
    int N;
    cin >> N;
    int s = 0;
    for(int i = 0; i < 10; ++i)
    {
        cin >> arr[i];
        s += arr[i];
    }

    int tot = 0 , f = 1;
    int c = N-s+2;
    for(int i = 0; i < c; ++i)
    {
        memset(memo,-1,sizeof(memo));
        tot = (tot + 1LL*f * dp(N,9))%MOD;
        if(arr[0]>0)arr[0]-- , s--;
        N--;
        f *= -1;
    }
    cout <<  tot << endl;

}
/*
2
0 1 0 0 0 0 0 0 0 0

1
0 1 0 0 0 0 0 0 0 0

 */

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;

#define mod 1000000007

int num[11];
int dp[11][105];
long long C[120][120];
void cal()
{
    C[1][1]=1;
    for(int i=0;i<101;i++)
        C[i][0]=1;
    for(int i=2;i<101;i++)
        for(int j=1;j<=i;j++)
        {
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
}
int main()
{
    cal();
    int n;
    scanf("%d",&n);
    for(int i=1;i<=10;i++)
        scanf("%d",num+i);
    long long sum=0;
    for(int z=0;z<=n;z++)
    {
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        for(int i=1;i<=10;i++)
            for(int j=num[i];j<=z;j++)
                for(int k=0;k+j<=z;k++)
                {
                    if(k==99)
                    {
                        int tt=0;
                    }
                    if(i!=1)
                        dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-k][j])%mod)%mod;
                    else
                    {
                        dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-1][j])%mod)%mod;
                    }
                }
        sum=(sum+dp[10][z])%mod;
    }
    printf("%I64d\n",sum);
    return 0;
}

#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

const int N = 2e6;
const ll mod = 1e9 + 7;
const ll inf = 1e15;

ll a[10], n, F[200][10], c[200][200];

ll f(ll n, ll k){
	if (F[n][k] != -1) return F[n][k];
	if (k == 9) return F[n][k] = n >= a[9];
	if (k){
		ll ans = 0;
		for (ll i = a[k]; i <= n; i++) {
			ans += f(n - i, k + 1) * c[n][i] % mod;
		}
		return F[n][k] = ans;
	}
	ll ans = 0;
		for (ll i = a[k]; i < n; i++) {
			ans += f(n - i, k + 1) * c[n - 1][i] % mod;
		}
	return F[n][k] = ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	c[0][0] = 1;
	for (int n = 1; n <= 105; n++){
		for (int r = 0; r <= n; r++){
			if (r) c[n][r] += c[n - 1][r - 1];
			if (r <= n - 1) c[n][r] += c[n - 1][r];
			c[n][r] %= mod;
		}
	}

	memset (F, -1, sizeof(F));

	cin >> n;

	for (int i = 0; i <= 9; i++)
		cin >> a[i];

	ll ans = 0;
	for (int l = 1; l <= n; l++){
		ans += f(l, 0);
		ans %= mod;
	}

	cout << ans;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <map>
#include <string>
#include <sstream>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repf(i,k,n) for(int i=k;i<n;i++)

#define wl(c) cout<<c<<endl
#define wr(c) cout<<c
#define rd(c) cin>>c
#define va << " " <<

#define ll long long
#define M 1000000007

int n;
int* d;
int* cum;
int ii[10];

int pn[101];
map<string,ll> ht;

ll ss(int from,int len)
{
    stringstream cur;
    cur << from << " " << len;
    string str = cur.str();
    if (ht.count(str)>0) return ht[str];

    ll res = 0;
    if (from == 9)
    {
        if (len >= d[9]) return 1;
        else return 0;
    }
    if (from == 8 && len == 1)
    {
        int kk = 2;
        kk ++;
        from = from + 1 - 1;
    }

    for (ii[from]=d[from] ; ii[from]<= len-cum[from+1] ; ii[from] ++)
    {
        int l = len-ii[from];

        ll k = ss(from+1,l);

        rep(i,101) pn[i] = 0;
        for(int i = l+(from==0 ? 0 : 1) ; i <= l+ii[from]-1+(from==0 ? 0 : 1) ; i ++)
        {
            int a = 2 , m = i;
            while (m > 1)
            {
                while (m%a==0)
                {
                    pn[a]++;
                    m=m/a;
                }
                a++;
            }
        }
        for(int i = 1 ; i <= ii[from] ; i ++)
        {
            int a = 2 , m = i;
            while (m > 1)
            {
                while (m%a==0)
                {
                    pn[a]--;
                    m=m/a;
                }
                a++;
            }
        }
        ll z = 1;
        rep(i,101)
        {
            rep(j,pn[i]) z = (z * i) % M;
        }

        res = (res + (z*k)) % M;
    }

    //wl("("<<from<<","<<len<<") = "<<res);
    ht[str] = res;
    return res;
}

//#define cin inf
main()
{
    //ifstream inf("D:\\shuold move\\d&d 12\\My Documents\\consol programming\\in.txt");

    rd(n);
    d = new int[10];
    rep(i,10) rd(d[i]);
    cum = new int[11];
    cum[10] = 0;
    cum[9] = d[9];
    for(int i = 8; i >= 0 ; i --) cum[i] = cum[i+1] + d[i];

    ll all = 0;
    for (int l = cum[0] ; l <= n ; l ++)
        all += ss(0,l);
    wl(all);
}

#include <bits/stdc++.h>

using namespace std;

const int INF = 1000000000;
const int MOD = INF + 7;
const char newline = '\n';
const int MAXN = 101;

int d[11];
int C[MAXN][MAXN];

int dp[11][MAXN][MAXN];
int f(int dig,int len,int sob){
    int& ans = dp[dig][len][sob];
    if(ans == -1){
        if(len == 0){
            return 1;
        } else if (dig == 10) {
            return 0;
        } else {
            ans = 0;
            for(int i = 0 ; i <= sob ; i++){
                ans = (ans%MOD + (C[len][d[dig]+i]%MOD * f(dig+1,len-(d[dig]+i),sob-i)%MOD)%MOD)%MOD;
            }
        }
    }
    return ans;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    for(int i = 0 ; i < MAXN ; i++){
        C[i][0] = 1;
        for(int j = 1 ; j <= i ; j++){
            C[i][j] = (C[i-1][j-1]%MOD + C[i-1][j]%MOD)%MOD;
        }
    }
    int n,s,ans,m;
    while(cin >> n){
        for(int i = 0 ; i < 10 ; i++){
            cin >> d[i];
        }
        s = accumulate(d,d+10,0);
        ans = 0;
        for(int i = 1 ; i < 10 ; i++){
            if(d[i]){
                d[i]--;
                memset(dp,-1,sizeof dp);
                for(int ss = s-1 ; ss < n ; ss++){
                    ans = (ans%MOD + f(0,ss,ss-(s-1))%MOD)%MOD;
                }
                d[i]++;
            } else {
                memset(dp,-1,sizeof dp);
                for(int ss = s ; ss < n ; ss++){
                    ans = (ans%MOD + f(0,ss,ss-s)%MOD)%MOD;
                }
            }
        }
        cout << ans << newline;
    }
}

#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define stp setprecision(9)//use fixed before stp
#define endl '\n'
ll minv(ll x)
{
    ll y=mod-2;
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        res%=mod;
        y = y >> 1;
        x = x * x;
        x%=mod;
    }
    return res;
}
int main()
{
    FAST
    #ifndef ONLINE_JUDGE
        freopen("input.txt" , "rt" , stdin);
        freopen("output.txt" , "wt" , stdout);
    #endif
    ll n;
    cin>>n;
    ll a[10];
    for(ll i=0;i<10;i++)
    {
        cin>>a[i];
    }
    ll fac[101],inv[101];
    fac[1]=1;inv[1]=1;fac[0]=1;inv[0]=1;
    for(ll i=2;i<101;i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
        inv[i]=minv(fac[i]);
    }
    ll d[10][101];
    for(ll i=0;i<10;i++)
    {
        for(ll j=0;j<=100;j++)
        {
            d[i][j]=0;
        }
    }
    for(ll i=a[9];i<101;i++)
    {
        d[9][i]=inv[i];
    }
    for(ll i=8;i>0;i--)
    {
        for(ll j=a[i];j<=100;j++)
        {
            for(ll k=0;k<=(100-j);k++)
            {
                d[i][j+k]+=d[i+1][k]*inv[j];
                d[i][j+k]%=mod;
            }
        }
    }
    ll zero[101][101];
    for(ll i=0;i<=100;i++)
    {
        for(ll j=0;j<=100;j++)
        {
            zero[i][j]=0;
        }
    }
    for(ll i=0;i<=100;i++)
    {
        for(ll j=0;j<=100;j++)
        {
            zero[i][j]+=d[1][j]*inv[i];
            zero[i][j]%=mod;
        }
    }
    ll ans=0;
    for(ll i=a[0];i<=100;i++)
    {
        for(ll j=0;j<=(n-i);j++)
        {
            ans+=zero[i][j]*fac[j+i];
            ans%=mod;
            if(i>0)
                ans-=zero[i-1][j]*fac[j+i-1];
            ans%=mod;
            ans+=mod;
            ans%=mod;
        }
    }
    cout<<ans;
}

#include <bits/stdc++.h>
using namespace std;
#define _ ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define MOD 1000000007
#define EPS 1e-12
#define lp(i,n) for(int i=0;i<n;i++)
#define clr(x) memset(x,0,sizeof x)
#define fi first
#define se second
#define Pi acos(-1)
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, pi> pii;
#define N 105
ll n, m, k;
ll arr[10];
ll cdp[N][N], dp[N][15];
ll C(int n, int k) {
    if (k > n)return 0;
    if (n == 0 || k == 0) {
        return 1;
    }
    ll &ret = cdp[n][k];
    if (ret != -1)return ret;
    return ret = (C(n - 1, k) + C(n - 1, k - 1)) % MOD;
}

ll sol(int len, int idx) {
    ll &ret = dp[len][idx];
    if (ret != -1)return ret;
    if (len < arr[idx])
        return ret=0;
    if (idx == 9)
        return ret=(len >= arr[9]);
    ll tmp=0;
    if (idx == 0)
        for (int i = arr[0]; i < len; i++)
            tmp = (tmp + (sol(len - i, 1) * C(len - 1, i) % MOD)) % MOD;
    else
        for (int i = arr[idx]; i <= len; i++)
            tmp = (tmp + (sol(len - i, idx + 1) * C(len, i)) % MOD) % MOD;
    return ret=tmp;

}
int main() {
    _
    //freopen("input.txt", "r", stdin);
    //freopen ("output.txt","w",stdout);
    cin>>n;
    lp(i, 10)cin >> arr[i];
    memset(dp, -1, sizeof dp);
    memset(cdp, -1, sizeof dp);
  //  cout << sol(n, 0)<<endl;
    ll out=0;
    lp(j,n+1){
        out+=sol(j,0);
        out%=MOD;
        }
    cout<<out<<endl;
    return 0;
}

// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,',');
    cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n;
int a[10];

int f[101];
int invf[101];
int cache[101][10];

void precal(){
    f[0]=1;
    invf[0]=1;
    for(int i=1; i<101; i++){
        f[i]=i*f[i-1];
        invf[i]=power(f[i],mod-2);
    }
}

int ncr(int N, int R){
    int res=(((f[N]*invf[R])%mod)*invf[N-R])%mod;
    return res;
}

int dp(int n, int i){
    if(i==10){
        if(n==0) return 1;
        else return 0;
    }
    int &ans=cache[n][i];
    if(ans!=-1) return ans;
    ans=0;
    for(int j=a[i]; j<=n; j++){
        int numWays;
        if(i==0) numWays=(ncr(n-1,j)*dp(n-j,i+1))%mod;
        else numWays=(ncr(n,j)*dp(n-j,i+1))%mod;
        add(ans,numWays);
    }
    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    precal();
    cin >> n;
    rep(i,0,10) cin >> a[i];
    mst(cache,-1);
    int res=0;
    for(int i=1; i<=n; i++){
        add(res,dp(i,0));
    }
    cout << res;
    return 0;
}

//====================================
//======================================
//
//                   Bismillahir-Rahmanir-Rahim
//
// ==========================================================================
#include <bits/stdc++.h>
#define        ll                              long long int
#define        FOR(x,y,z)                      for(int x=y;x<z;x++)
#define        pii                             pair<int,int>
#define        pll                             pair<ll,ll>
#define        CLR(a)                          memset(a,0,sizeof(a))
#define        SET(a)                          memset(a,-1,sizeof(a))
#define        N                               101
#define        M                               1000000007
#define        pi                              acos(-1.0)
#define        ff                              first
#define        ss                              second
#define        pb                              push_back
#define        inf                              (1e9)+1000
#define        eps                             1e-9
#define        ALL(x)                          x.begin(),x.end()
using namespace std;
int dx[]={0,0,1,-1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,1,-1};
template < class T> inline T biton(T n,T pos){return n |((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
template <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
template <class T> inline T bigmod(T p,T e,T m){T ret = 1;
for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % m;p = (p * p) % m;
} return (T)ret;}
#ifdef sayed
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<endl;
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int ar[N];
ll ncr[N][N];
int sum[N];
ll dp[101][101];
ll go(int pos,int n){
     //debug(pos,n);
    if(pos>=10) {
        return n==0;
    }
    ll &res = dp[pos][n];
    if(res!=-1) return res;
    res = 0;
    ll up =n-sum[pos+1];
    for(int i = ar[pos];i<=n;i++){
        if(pos==0){
            res+=go(pos+1,n-i)*ncr[n-1][i];
        } else
            res +=go(pos+1,n-i)*ncr[n][i];
        res %=M;
    }
    return res;
}
int main(){
    #ifdef sayed
    //freopen("out.txt","w",stdout);
    // freopen("in.txt","r",stdin);
    #endif
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n = nxt();
    for(int i = 0;i<10;i++) {
        ar[i] = nxt();

    }
    if(sum[0]>n){
        cout<<0<<endl;
        return 0;
    }
    ncr[0][0]=1;
    for(int i = 1;i<=100;i++) {
        ncr[i][0]=ncr[i][i] = 1;
        for(int j = 1;j<i;j++) {
            ncr[i][j] = ncr[i-1][j] + ncr[i-1][j-1];
            ncr[i][j]%=M;
        }
    }
   // debug(ncr[5][2]);
    if(ar[0]>=n){
        cout<<0<<endl;
        return 0;
    }
    for(int i = 9;i>=0;i--) {
        sum[i]+=sum[i+1]+ar[i];
    }
    ll ans = 0;
  //  cout<<go(0,2)<<endl;
    for(int i = sum[0];i<=n;i++){
        SET(dp);
        ans+=go(0,i);
        ans%=M;
    }
    printf("%lld\n",ans);
    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<vector>
#define all(c) c.begin(),c.end()
using namespace std;
typedef long long int int64;
int dp[1001][11];
int C[105][105];
int a[10];
void init_C()
{
    memset(C,0,sizeof C);
    C[0][0]=1;
    for(int i=1;i<=100;i++)
       for(int j=0;j<=i;j++)
          C[i][j]=C[i-1][j]+C[i-1][j-1];
}
int calc(int n)
{
    memset(dp,0,sizeof dp);
    int i,j,k;

    for(i=1;i<=n;i++)
       dp[i][0]=1;

    for(i=0;i<10;i++)
    {
        for(j=0;j<=n;j++)
        {
                int w=j-(i==0);
                for(k=a[i];k<=w;k++)
                {
                    dp[j-k][i+1]+=dp[j][i]*C[w][k];
                }
            }
    }

    cout<<dp[0][10];

}
int main()
{
    //freopen("input.txt","r",stdin);
    int i,j,n,m;
    init_C();
    cin>>n;
    for(i=0;i<10;i++)
       cin>>a[i];

    calc(n);

    return 0;
}

#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <climits>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ff first
#define ss second
#define LL long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define sqr(x) ((x) * (x))
#define PI 3.1415926535897932384626433832795
using namespace std;

LL c[101][101];

void init() {
    for(int i = 0; i < 101; i++) c[i][i] = c[0][i] = 1;
    for(int i = 1; i < 101; i++)
        for(int l = 1; l < 101; l++)
    c[i][l] = (c[i - 1][l - 1] + c[i][l - 1]) % MOD;
}

int main() {
    LL n, i, l, j, k, ans = 0ll, a[101], dp[101][101];
    init(); scanf("%lld", &n);
    memset(dp, 0, sizeof(dp));
    for(i = 0; i < 10; i++) scanf("%lld", &a[i]);
    for(i = a[9]; i <= n; i++) dp[i][9] = 1ll;
    for(i = 0; i <= n; i++) {
        for(l = 8; l > 0; l--) {
            for(j = a[l]; j <= i; j++) {
                dp[i][l] = (dp[i][l] + dp[i - j][l + 1] * c[j][i]) % MOD;
//              cout << c[j][i] << " " << dp[i][l] << endl;
//              system("pause");
            }
        }
    }
    for(i = 0; i <= n; i++) {
        for(l = a[0]; l <= i; l++) {
            dp[i][0] += (dp[i - l][1] * c[l][i - 1]) % MOD;
        }
        ans = (ans + dp[i][0]) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(typeof(n) i = 0; i < (n); ++i)
#define Repd(i,n) for(typeof(n) i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(typeof(b) i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(typeof(a) i = (a); i >= (b); --i)
#define Fit(i,v) for(typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) for(typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define nl puts("")
#define sp printf(" ")
#define ok puts("ok")
//#include <conio.h>

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> void db(T a, int p = -1) { if (p >= 0) cout << fixed << setprecision(p); cout << a << " "; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> struct Triple { T x, y, z; Triple() {} Triple(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {} };
template<class T> Triple<T> euclid(T a, T b) { if (b == 0) return Triple<T>(1, 0, a); Triple<T> r = euclid(b, a % b); return Triple<T>(r.y, r.x - a / b * r.y, r.z); }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

const double PI = 2 * acos(0);
const string months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dr[] = {-1, 0, +1, 0};
const int dc[] = {0, +1, 0, -1};
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const double eps = 1e-9;
const ll mod = 1000000007;
typedef pair<int, int> II;

int n, a[10];
ll C[105][105];

void init(){
    ms(C, 0);
    Rep(i, 105) C[0][i] = 1;
    For(i, 1, 100) For(j, 1, i) C[j][i] = (C[j - 1][i - 1] + C[j][i - 1]) % mod;
}

ll cal(){
    ll f[105][105];
    ms(f, 0);
    For(i, 0, n) if(i >= a[0]) f[i][0] = 1;
  //  cout << a[1] << endl;
  //  cout << f[1][0] << f[2][0] << endl;
    For(j, 1, 9) For(i, 0, n) For(k, a[j], i){
        f[i][j] = (f[i][j] + C[k][i] * f[i - k][j - 1]) % mod;
    }
   // cout << f[n][1] << " ... " << endl;
    ll res = 0;
    For(i, 0, n) res += f[i][9];
    return res;
}

int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    init();
    scanf("%d", &n);
    Rep(i, 10) scanf("%d", &a[i]);
    ll res = cal();
   // cout << res << endl;
    a[0] = max(0, a[0] - 1);
    n--;
    res = (((res - cal()) % mod) + mod) % mod;
    cout << res;
    return 0;
}

#include<bits/stdc++.h>
typedef long long ll;
#define M 1000000007
#define endl "\n"
#define rep(a,b,in) for(int i=a;i<b;i+=in)
#define int long long
using namespace std;
int fact[105];
ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
ll InverseEuler(ll n, ll MOD)
{
    return poww(n, MOD - 2, MOD);
}

ll C(ll n, ll r, ll MOD)
{

    return (fact[n] * ((InverseEuler(fact[r], MOD) * InverseEuler(fact[n - r], MOD)) % MOD)) % MOD;
}

int a[15];
int n;

int dp[15][105];
int rec(int ind,int left)
{

	if(ind==10)
	{
		if(left==0)
		{
			return 1;
		}
		return 0;
	}
	if(dp[ind][left]>=0)
	{
		return dp[ind][left];
	}
	if(a[ind]>left)
	{
		return 0;
	}
	if(ind==0)
	{
		int ans=0;
		for(int i=max(a[ind],1ll);i<=left;i++)
		{
			ans+=((C(left,i,M)-C(left-1,i-1,M)+M)%M)*rec(ind+1,left-i);
			ans%=M;
		}
		if(a[ind]==0)
		{
			ans+=rec(ind+1,left);
			ans%=M;
		}
		dp[ind][left]=ans;
		return ans;
	}
	int ans=0;
	for(int i=a[ind];i<=left;i++)
	{
		ans+=C(left,i,M)*rec(ind+1,left-i);
		ans%=M;
	}
	dp[ind][left]=ans;
	return ans;
}
int32_t main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    memset(dp,-1,sizeof(dp));
   	fact[0]=1;
   	for(int i=1;i<105;i++)
   	{
   		fact[i]=fact[i-1]*i;
   	}
    cin>>n;
    for(int i=0;i<10;i++)
    {
    	cin>>a[i];
    }
    int ans=0;
    for(int i=0;i<=n;i++)
    {
    	ans+=rec(0,i);
    	ans%=M;
    }
    cout<<ans;
}

#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <string.h>
#include <string>
#include <vector>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <fstream>
#include <memory.h>

using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<long long> vll;

using namespace std;
int n;
long long dp[110][15];
int a[15];
const int mo = 1e9+7;
long long com[110][110];

void comp() {
    for (int i = 0; i <= 100; i++) {
        com[i][0] = 1;
        for (int j = 0; j <= i; j++) {
            com[i+1][j+1] = com[i][j]+com[i][j+1];
            com[i+1][j+1] %= mo;
        }
    }
}

int main() {
    cin >> n;
    comp();
    for (int i = 0; i <= 9; i++) {
        cin >> a[i];
    }
    for (int i = 0; i <= n; i++) {
        dp[i][9] = i>=a[9];
        for (int j = 8; j > 0; j--) {
            for (int k = a[j]; k <= i; k++) {
                dp[i][j] += dp[i-k][j+1]*com[i][k];
            }
            dp[i][j] %= mo;
        }
        for (int k = a[0]; k <= i; k++) {
            if (i > 0) {
                dp[i][0] += dp[i-k][1]*com[i-1][k];
            }
        }
        dp[i][0] %= mo;
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += dp[i][0];
    }
    cout << ans;
}

#include <bits/stdc++.h>

using namespace std;

long long n,a[10],dp[2][169],fc[169],ifc[169],pwk,dv=1e9+7;

long long pw(long long x,long long y)
{
	if(!y)
	{
		return 1;
	}
	pwk=pw(x,y/2);
	pwk=pwk*pwk%dv;
	if(y%2)
	{
		pwk=pwk*x%dv;
	}
	return pwk;
}

long long cb(long long x,long long y)
{
	return fc[x]*ifc[y]%dv*ifc[x-y]%dv;
}

int main()
{
	long long i,j,r,ii,k,sm,z=0;

	scanf("%lld",&n);
	fc[0]=1;
	ifc[0]=1;
	for(i=1;i<=n;i++)
	{
		fc[i]=fc[i-1]*i%dv;
		ifc[i]=pw(fc[i],dv-2);
	}
	for(i=0;i<10;i++)
	{
		scanf("%lld",a+i);
	}
	for(ii=!!a[0];ii+1;ii--)
	{
		for(i=0;i<=n-ii;i++)
		{
			dp[0][i]=0;
		}
		dp[0][0]=1;
		sm=0;
		for(i=0;i<10;i++)
		{
			k=a[i]-(!i&&ii);
			for(j=0;j<=n-ii;j++)
			{
				dp[1][j]=0;
				for(r=k;r<=j;r++)
				{
					dp[1][j]=(dp[1][j]+dp[0][j-r]*cb(j,r))%dv;
				}
			}
			for(j=0;j<=n-ii;j++)
			{
				dp[0][j]=dp[1][j];
				if(i==9)
				{
					sm=(sm+dp[0][j])%dv;
				}
			}
		}
		z=(sm+dv-z)%dv;
	}
	printf("%lld\n",z);
}

//dij
#include <iostream>
#include <fstream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#define  N   301
#define  inf 0XFFFFFFF
#define  mod 1000000007
#define  ll long long
using namespace std;

//ofstream fo("out.txt");
//ifstream fi("in.txt");
//#define cout cout
//#define cin fi

int n,a[10],s[10];
ll c[N][N];
ll dfs(int n,int now)
{
    ll ans=0;
    if(now>=1&&s[9]-s[now-1]>n)return 0;
    if(now==0&&s[9]>n) return 0;
    if(now==9)
    {
        return 1;
    }
    else if(now!=0)
    {
        for(int i=a[now];i<=n-s[9]+s[now];i++)
        {
            ans+=c[i+n-i+1-1][n-i+1-1]*dfs(n-i,now+1);
            if(ans>=mod)ans%=mod;
        }
        return ans;
    }
    else
    {
        for(int i=a[now];i<=n-s[9]+s[now];i++)
        {
            ans+=c[i+n-i-1][n-i-1]*dfs(n-i,now+1);
            if(ans>=mod) ans%=mod;
        }
    }
    return ans;
}
int main()
{
    int i,j;
    cin>>n;
    for(i=0;i<10;i++)
        cin>>a[i];
    for(i=0;i<301;i++)
    for(j=0;j<=i;j++)
    c[i][j]=1;
    for(i=0;i<300;i++)
    {
        for(j=1;j<i;j++)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            if(c[i][j]>=mod)c[i][j]/=mod;
        }
    }
    s[0]=a[0];
    for(i=1;i<10;i++)
        s[i]=s[i-1]+a[i];
    long long ans=0;
    for(i=s[9];i<=n;i++)
    {
        ans+=dfs(i,0);
        if(ans>=mod) ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef vector<ii> vii;
typedef vector<ll> vi;

#define INF 1000000000000000

ll c[101][101];

ll ncr(ll n, ll r)
{
    if(c[n][r]!=-1)
        return c[n][r];
    if(n<=r)
    {
        c[n][r] = 1;
        return 1;
    }
    if(r==0)
    {
        c[n][r] = 1;
        return 1;
    }

    c[n][r] = ncr(n-1,r-1) + ncr(n-1,r);
    return c[n][r];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n;
    cin >> n;

    ll a[10];
    rep(i,10)
    {
        cin >> a[i];
    }

    ll mod = 1000000007;

    ll dp[n+1][10];
    fill0(dp);
    rep(i,101)
    {
        rep(j,101)
        {
            c[i][j] = -1;
        }
    }

    rep(i,n+1)
    {
        if(i>=a[9])
            dp[i][9] = 1;
        else
            dp[i][9] = 0;
    }

    frr(i,8,1)
    {
        fr(j,0,n)
        {
            fr(k,a[i],j)
            {
                dp[j][i] = (dp[j][i]%mod + (dp[j-k][i+1])%mod*(ncr(j,k)%mod)%mod)%mod;
            }
        }
    }

    fr(j,0,n)
    {
        fr(k,a[0],j)
        {
            dp[j][0] = (dp[j][0]%mod + (dp[j-k][1])%mod*(ncr(j-1,k)%mod)%mod)%mod;
        }
    }

    ll ans = 0;
    rep(i,n+1)
    {
        ans = (ans%mod + dp[i][0]%mod)%mod;
    }

    cout << ans << endl;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define ld long double
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

const int N = 105, M = 1e9 + 7;
int dp[N][N], C[N][N], n, a[10], out, s;

void init() {
    C[0][0] = 1;
    for (int i = 1; i < N; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % M;
        }
    }
    memset(dp, -1, sizeof dp);
}

int rec(int indx, int len) {
    if (indx == 10)
        return (len == 0);
    int &re = dp[indx][len];
    if (re != -1) {
        return re;
    }
    re = 0;
    if (indx) {
        for (int i = a[indx]; i <= len; i++) {
            re += ((rec(indx + 1, len - i) % M) * (C[len][i]) % M) % M;
        }
    } else {
        for (int i = a[indx]; i <= len - 1; i++) {
            re += ((rec(indx + 1, len - i) % M) * (C[len - 1][i]) % M) % M;
        }
    }
    return re % M;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    init();
    cin >> n;
    for (int i = 0; i < 10; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        out = ((out % M) + (rec(0, i) % M)) % M;
    }
    cout << out << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int MOD = 1e9 + 7;

int a[10];
int n;
int dp[11][101];
int fact[101], invf[101];

int comb(int n, int k) {
    return 1LL * fact[n] * invf[k] % MOD * invf[n - k] % MOD;
}

int logpow(int b, int e) {
    int ans(1);
    while (e) {
        if (e&1)
            ans = 1LL * ans * b % MOD;
        b = 1LL * b * b % MOD;
        e >>= 1;
    }
    return ans;
}

int solve() {
    dp[0][0] = 1;
    for (int i = 1; i <= 10; ++i) {
        for (int j = 0; j <= n; ++j) {
            dp[i][j] = 0;
            for (int k = a[i - 1]; k <= j; ++k)
                dp[i][j] = (dp[i][j] + 1LL * comb(j, k) * dp[i - 1][j - k]) % MOD;
        }
    }
    int ans(0);
    for (int j = 0; j <= n; ++j)
        ans = (ans + dp[10][j]) % MOD;
    return ans;
}

int main()
{
    fact[0] = 1;
    for (int i = 1; i < 101; ++i)
        fact[i] = 1LL * fact[i - 1] * i % MOD;
    invf[100] = logpow(fact[100], MOD - 2);
    for (int i = 99; i >= 0; --i)
        invf[i] = 1LL * invf[i + 1] * (i + 1) % MOD;
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    int mind(0);
    for (int i = 0; i < 10; ++i)
        cin >> a[i], mind += a[i];
    int ans(0);
    if ((mind == 1 && a[0] == 1) || mind == 0)
        ans++;///se pune 0
    ans += solve();
    if (ans >= MOD)
        ans -= MOD;
    if (a[0])
        --a[0];
    --n;
    ans -= solve();
    if (ans < 0)
        ans += MOD;
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-9

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define sgn(x) (((x)>eps)-((x)<-eps))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

VI multiply(VI a, VI b, int n) {

	VI c(a.size()+b.size(), 0);

	for (int i=0; i<a.size(); i++) {

		for (int j=0; j<b.size(); j++) {

			c[i+j]=(c[i+j]+(INT)a[i]*b[j])%MOD;

		}

	}

	c.resize(n+1);

	return c;

}

const int NN = 222;

int a[NN], inv[NN], fac[NN];

int solve(int n) {

	VI c(n+1); c[0]=1;

	for (int i=0; i<10; i++) {

		VI b(n+1, 0);

		for (int j=a[i]; j<=n; j++) b[j]=inv[j];

		c=multiply(c, b, n);

	}

	int sum=0;

	for (int i=0; i<=n; i++) sum=(sum+(INT)c[i]*fac[i])%MOD;

	return sum;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n;

	gn(n);

	for (int i=0; i<10; i++) gn(a[i]);

	for (int i=fac[0]=1; i<NN; i++) fac[i]=(INT)fac[i-1]*i%MOD;

	inv[NN-1]=power(fac[NN-1], MOD-2, MOD);

	for (int i=NN-2; i>=0; i--) inv[i]=(INT)inv[i+1]*(i+1)%MOD;

	int ans=solve(n);

	if (a[0]) a[0]--;

	n--;

	ans=(ans+MOD-solve(n))%MOD;

	println(ans);

	return 0;

}

#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<cmath>
#include<assert.h>

#define ll  long long
#define FO(i,s,e,p) for(ll i=s;i<e;i+=p)
#define FOD(i,s,e,p) for(ll i=s;i>e;i-=p)

#define FOR(i,s,e) FO(i,s,e,1)
#define FORE(i,s,e) FOR(i,s,e+1)
#define FORD(i,s,e) FOD(i,s,e,1)
#define FORDE(i,s,e) FORD(i,s,e-1)

#define ALL(i,s,e) for(__typeof(s) i=s;i!=e;i++)

#define MEM(tab,fill) memset(tab,fill,sizeof(tab))

#include<iostream>
#include<set>
#include<vector>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<algorithm>
#include<utility>
#include<bitset>

using namespace std;
#define ll long long
#define inf ((1<<30)-1)
#define debug(a) cout<<#a<<" "<<a<<endl
#define pb push_back
#define mp make_pair
#define MODULO 1000000007

ll pas[110][110];

void isnt()
{
  FOR(n,0,110){
    pas[n][0]=0;pas[n][n]=1;
    FOR(m,0,n) pas[n][m]=(pas[n-1][m-1]+pas[n-1][m])%MODULO;
  }
}

ll fact(int n,int m)
{
  return pas[n][m];
}

ll dp[110][11];

int main()
{
  //freopen("C:\\a","r",stdin);
  isnt();

  int n,ar[10],sum=0;
  cin>>n;
  FOR(i,0,10) cin>>ar[i],sum+=ar[i];
  MEM(dp,0);

  FORE(i,ar[9],n) dp[i][9]=1;

  FORDE(num,8,0)
    FORE(len,0,n)
      FORE(k,ar[num],len)
        dp[len][num]+=(dp[len-k][num+1]*fact(len-(num==0),k))%MODULO,dp[len][num]%=MODULO;
  ll res=0;
  FORE(len,0,n) res+=dp[len][0],res%=MODULO;

  cout<<res<<endl;

  return 0;
}

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli N=105;
const lli mod=1000000007L;
lli fac[N+5],inv[N+5];

lli po(lli a,lli n)
{
    if(n==0)
        return 1;
    if(n%2)
        return (a*po(a,n-1))%mod;
    return po(a*a%mod,n/2);
}

lli nCr(lli n,lli r)
{
    if(n<0||r<0||r>n)
        return 0;
    lli ans=1;
    ans=(ans*fac[n])%mod;
    ans=(ans*inv[r])%mod;
    ans=(ans*inv[n-r])%mod;
    return ans;
}

void pre(lli n)
{
    lli i;
    fac[0]=1;
    repA(i,1,n)
        fac[i]=(i*fac[i-1])%mod;
    inv[n]=po(fac[n],mod-2);
    repD(i,n,1)
        inv[i-1]=(i*inv[i])%mod;
    assert(inv[0]==1);
}

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;

void multi(vi &a,const vi &b)
{
    const lli n=sz(a),m=sz(b);
    lli i,j;
    vi c(min(n+m,N),0);
    fo(i,n)     fo(j,m)
    {
        if(i+j>=N)
            break;
        c[i+j]+=a[i]*b[j];
        c[i+j]%=mod;
    }
    // dbg(a,b,c);
    a.swap(c);
}

lli ans;
vi c;
void solve()
{
    lli i,j;
    c.resize(n+1,0);
    c[0]=1;
    repA(i,1,9)
    {

        vi d(n+1,0);
        repA(j,a[i],n)
            d[j]=inv[j];
        dbg(i,d);
        multi(c,d);
    }
    fo(i,n)
        c[i]=(c[i]*fac[i])%mod;
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{
    pre(N);
    // dbg(fac[0])
    cin>>n;
    fo(i,10)
    {
        cin>>in;
        a.pb(in);
    }
    dbg(a)
    solve();
    for(lli p=1;p<=n;++p)
    for(lli z=a[0];z<p;++z)
        ans+=nCr(p-1,z)*c[p-z]%mod;
    ans%=mod;
    ans+=mod;
    ans%=mod;

    cout<<ans<<endl;
}   aryanc403();
    return 0;
}

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const ll mod = 1e9 + 7;
const int MaxN = 1e2;

int cnt[10];
ll cnk[MaxN + 1][MaxN + 1];

ll getCNK (int n, int k) {
	if (cnk[n][k] != -1) return cnk[n][k];
	if (n == 0) {
		if (k == 0) return 1; else return 0;
	}
	if (n < k) return 0;
	return cnk[n][k] = (getCNK(n - 1, k) + getCNK(n - 1, k - 1)) % mod;
}

int main () {
	for (int i = 0; i <= MaxN; i++)
		for (int j = 0; j <= MaxN; j++)
			cnk[i][j] = -1;
	int n;
	scanf ("%d", &n);
	int sm = 0;
	for (int i = 0; i < 10; i++) {
		scanf ("%d", &cnt[i]);
		sm += cnt[i];
	}
	if (sm > n || (cnt[0] == n)) {
		printf ("0");
		return 0;
	}
	if (cnt[0] == 1 && n == 1) {
		printf ("1");
		return 0;
	}
	ll res = 0;

	for (int firstNum = 1; firstNum < 10; firstNum++) {
		bool dec = false;
		if (cnt[firstNum] > 0) {
			cnt[firstNum]--;
			dec = true;
		}
		n--;

		ll curRes = 1;
		int left = n;
		for (int i = 0; i < 10; i++) {
			curRes = (curRes * getCNK(left, cnt[i])) % mod;
			left -= cnt[i];
		}

		for (int i = 0; i < left; i++)
			curRes = (curRes * 10) % mod;

		res = (res + curRes) % mod;

		n++;
		if (dec)
			cnt[firstNum]++;
	}
	printf ("%lld", res);
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cassert>
#include <fstream>
#include <map>
#include <cstring>
#include <numeric>
#include <ctype.h>
#define MOD  1000000009
#define MOD1 1000000007
#define exit return 0
#define N 1555
#define inf 1000000000000000000LL
typedef long long ll;
#define exit return 0
#define PS system("pause")
#define S 100007
#define mx(a,b) a>b?a:b
#define R0(i,n) for (i = 0; i < n; i++)
#define R1(i,n) for (i = 1; i <= n; i++)
#define MS(a,x) memset(x, a, sizeof(x));
#define left v<<1
#define right left|1
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
using namespace std;
int n, i, j, k, m, q, r, b;
int f[N], dp[N][N], a[N];
double ways[N][N], maxW;
ll C[N][N];
int maximal, pas;
int main(){
	scanf("%d", &n);
	R0(i, 10){
		scanf("%d", &a[i]);
	}
	R0(i, n + 1)C[i][0] = 1;
	R0(i, n + 1){ C[i][0] = 1;  R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1; }
	for (int i = a[9]; i <= n; i++){
		dp[9][i] = 1;
	}
	for (int i = 8; i >= 1; i--){
		for (int j = a[i]; j <= n; j++){
			for (int k = a[i]; k <= j; k++){
				dp[i][j] = (dp[i][j] + C[j][k] * dp[i + 1][j - k]) % MOD1;
			}
		}
	}
	for (int i = a[0]; i <= n; i += 1){
		for (int j = a[0]; j <= i; j++){
			pas += C[i - 1][j] * dp[1][i - j];
			pas %= MOD1;
		}
	}
	cout << pas << endl;
}

/*cin >> n;
R0(i, 10){
cin >> a[i];
}
R0(i, 10){
if (a[i]){
go = i; break;
}
}
R0(i, n + 1)C[i][0] = 1;
R1(i, n) R1(j, i) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; C[i][j] %= MOD1;
*/

#include <iostream>
using namespace std;
int dig[10];
long long combinatoria(long long n, long long k){
  if(n-k<k)
    k=n-k;
  long long r=1;
  for (int i = 0; i < k; ++i)
  {
    r *= (n - i);
    r /= (i + 1);
  }
  return r%1000000007;
}
long dp(int tam, int i){
  long long sum=0;
  if(i==0){
    for(int j=dig[0];j<=tam;++j){
      sum+=dp(tam-j,1)*combinatoria(tam-1,j);
      sum%=1000000007;
    }
    return sum%1000000007;
  }else if(i==9){
    return tam>=dig[9];
  }
  for(int j=dig[i];j<=tam;++j){
    sum+=dp(tam-j,i+1)*combinatoria(tam,j);
    sum%=1000000007;
  }
  return sum%1000000007;
}

int main() {
  //float Ax=0.0,Ay=0.0,Bx=1000.0,By=0.0,Cx=0.0,Cy=1000.0;
  //cout<<combinatoria(100,10);
  int n;
  int aux=0;
  cin>>n;
  for(int i=0;i<10;++i){
    cin>>dig[i];
    aux+=dig[i];
  }
  long sum=0;
  if (aux==0){
    sum=1;
    for(int i=0;i<n;++i){
      sum*=10;
      sum%=1000000007;
    }
  }else{
    for (int i=aux;i<=n;++i){
      sum+=dp(i,0);
      sum%=1000000007;
    }
  }
  cout<<sum;
}

#include <cmath>
#include <cctype>
#include <cstdio>
#include <climits>
#include <cstring>
#include <cassert>

#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define  repeat(i, l, r)  for(int i = (l); i <= (int)(r); ++i)
#define  taeper(i, r, l)  for(int i = (r); i >= (int)(l); --i)
#define  foreach(it, c)   for(decltype((c).begin()) it = (c).begin(); it!=(c).end(); ++it)
#define  foreachr(it, c)  for(decltype((c).rbegin()) it = (c).rbegin(); it!=(c).rend(); ++it)
#define  EPS              1e-9
#define  PI               acos(-1)

typedef unsigned long long int ull;
typedef unsigned int uint;
typedef long long int ll;
typedef long double ld;

inline int cmp(double x, double y=0, double tol=EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

typedef std::vector<ll>   ll_vector;
typedef std::vector<int>  int_vector;

const ll MOD = 1e9 + 7;

int left, used;
int_vector A(10), D(10);
ll_vector factorial(200), inverse(200), factorial_inverse(200);

void xgcd(ll a, ll b, ll &X, ll &Y) {
    ll x = 0, last_x = 1, y = 1, last_y = 0;
    if(a<b) {
        ll t=last_x; last_x=last_y; last_y=t;
        t=x; x=y; y=t; t=a; a=b; b=t;
    }
    while(b) {
        ll q=a/b; ll t=a; a=b; b=t%b;
        t=x; x=last_x-q*x; last_x=t;
        t=y; y=last_y-q*y; last_y=t;
    }
    X=last_x; Y=last_y;
}
ll mod(ll x) { return ((x)%MOD+MOD)%MOD; }
ll solve_mod(ll a, ll b) {
    if(a>=MOD||b>=MOD) return solve_mod(mod(a), mod(b));
    ll tx, ty;
    xgcd(a,MOD,tx,ty);
    ull d=a*tx+MOD*ty;
    if(b%d) return -1;
    return mod(b/d*tx);
}
ll inverse_mod(ll x) { return solve_mod(x,1); }

ll solve(int digit = 0, int digits_left = left) {
    ll aux, answer = 0;
    int size, times;

    if( digits_left == 0 || digit == 10 ) {
        size = used + left - digits_left - 1;
        repeat(i, 1, 9)
            if( A[i] + D[i] != 0 ) {
                aux = factorial[size];
                repeat(j, 0, 9) {
                    times = A[j] + D[j] - (i == j);
                    aux = (aux * factorial_inverse[times]) % MOD;
                }
                answer += aux;
            }
        return answer;
    }

    repeat(i, 0, digits_left) {
        D[digit] = i;
        answer = (answer + solve(digit + 1, digits_left - i)) % MOD;
        D[digit] = 0;
    }

    return answer;
}

int main() {
    //freopen("input.txt", "r", stdin);

    used = 0;
    scanf("%d", &left);

    repeat(i, 2, 199)
        inverse[i] = inverse_mod(i);

    repeat(i, 0, 199) {
        factorial[i] = 1;
        factorial_inverse[i] = 1;
        repeat(j, 2, i) {
            factorial[i] = (factorial[i] * j) % MOD;
            factorial_inverse[i] = (factorial_inverse[i] * inverse[j]) % MOD;
        }
    }

    repeat(i, 0, 9) {
        scanf("%d", &A[i]);
        used += A[i];
    }

    left -= used;

    std::cout << solve() << std::endl;

    //printf("%I64d\n", solve());

    //while(1);

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int maxx = 110, inf = ~0u/2, mod = 1e9 + 7;

long long ent[maxx][maxx], a[11], dp[maxx][11];

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < 10; i++)
		cin >> a[i];
	for(int i = 0; i <= n; i++)
	{
		ent[i][i] = ent[0][i] = 1;
	}
	for(int i = 0; i <= n; i++)
	{
		for(int j = 1; j < i; j++)
		{
			ent[j][i] = (ent[j][i - 1] + ent[j - 1][i - 1]) % mod;
		}
	}
	for(int i = 0; i <= n; i++)
	{
		for(int j = 9; j>= 0; j--)
		{
			if (j == 9)
			{
				dp[i][j] = 1;
				continue;
			}
			int h = i;
			if (j == 0)
				h--;
			for(int x = a[j]; x <= i; x++)
			{
				dp[i][j] = (dp[i][j] + ((dp[i - x][j + 1] * ent[x][h]) % mod)) % mod;
			}
		}
	}
	long long sum = 0;
	for(int i = 0; i <= n; i++)
	{
		sum = (sum + dp[i][0]) % mod;
	}
	cout << sum << endl;
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<cmath>
#include<assert.h>

#define ll  long long
#define FO(i,s,e,p) for(ll i=s;i<e;i+=p)
#define FOD(i,s,e,p) for(ll i=s;i>e;i-=p)

#define FOR(i,s,e) FO(i,s,e,1)
#define FORE(i,s,e) FOR(i,s,e+1)
#define FORD(i,s,e) FOD(i,s,e,1)
#define FORDE(i,s,e) FORD(i,s,e-1)

#define ALL(i,s,e) for(__typeof(s) i=s;i!=e;i++)

#define MEM(tab,fill) memset(tab,fill,sizeof(tab))

#include<iostream>
#include<set>
#include<vector>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<algorithm>
#include<utility>
#include<bitset>

using namespace std;
#define ll long long
#define inf ((1<<30)-1)
#define debug(a) cout<<#a<<" "<<a<<endl
#define pb push_back
#define mp make_pair
#define MODULO 1000000007

ll pas[110][110];

void isnt()
{
  MEM(pas,0);
  FOR(n,0,110){
    pas[n][0]=0;pas[n][n]=1;
    FOR(m,0,n) pas[n][m]=(pas[n-1][m-1]+pas[n-1][m])%MODULO;
  }
}

ll fact(int n,int m)
{
  //assert(n>=m);
  return pas[n][m];
}

ll dp[110][11];

int main()
{
  //freopen("C:\\a","r",stdin);
  isnt();

  int n,ar[10],sum=0;
  cin>>n;
  FOR(i,0,10) cin>>ar[i],sum+=ar[i];
  MEM(dp,0);

  FORE(i,ar[9],n) dp[i][9]=1;

  FORDE(num,8,0)
    FORE(len,ar[num],n)
      FORE(k,ar[num],len)
        dp[len][num]+=(dp[len-k][num+1]*fact(len-(num==0),k))%MODULO,dp[len][num]%=MODULO;
  ll res=0;
  FORE(len,0,n) res+=dp[len][0],res%=MODULO;

  cout<<res<<endl;

  return 0;
}

#include<bits/stdc++.h>

using namespace std;

const long long Mod=1e9+7;
const long long N=10;

long long FastPower(long long x,long long y);
long long Rec(long long i,long long k);
long long C(long long N,long long R);

long long n;
long long a[15];
long long Fact[110];
long long Dp[15][110];

int main()
{
    Fact[0]=1;  for(long long i=1;i<110;i++)   Fact[i]=(i*Fact[i-1])%Mod;

    cin>>n;

    for(long long i=0;i<N;i++)  scanf("%I64d",&a[i]);

    long long Answer=0;

    memset(Dp,-1,sizeof(Dp));

    for(long long i=1;i<=n;i++)   Answer=(Answer+Rec(0,i))%Mod;

    a[0]=max(a[0]-1,0LL);

    memset(Dp,-1,sizeof(Dp));

    for(long long i=2;i<=n;i++)   Answer=(Answer-Rec(0,i-1)+Mod)%Mod;

    cout<<Answer;

}

long long Rec(long long i,long long k)
{
    if(i==N)    return (k==0);

    if(Dp[i][k]!=-1)    return Dp[i][k];

    long long Res=0;

    for(long long j=a[i];j<=k;j++)    Res=(Res+(C(k,j)*Rec(i+1,k-j))%Mod)%Mod;

    return Dp[i][k]=Res;
}

long long FastPower(long long x,long long y)
{
    if(!y)  return 1;

    long long Res=FastPower(x,y>>1);    Res=(Res*Res)%Mod;

    if(y&1) Res=(Res*x)%Mod;

    return Res;
}

long long C(long long NN,long long R)
{
    if(R>NN) return 0;

    return (Fact[NN]*FastPower((Fact[R]*Fact[NN-R])%Mod,Mod-2))%Mod;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 666666666

ll A[11];
ll dp[101][11];
ll c[101][101];
ll mod = 1e9+7;

ll C(int n, int k)
{
    if(k==0 || n == k)return 1;
    if(c[n][k]!=-1)return c[n][k];
    return c[n][k] = (C(n-1,k) + C(n-1, k-1)) % mod;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    memset(c,-1,sizeof c);
    ll n;
    cin>>n;
    for(int i=0; i<10; i++)
        cin>>A[i];

    for(int i=A[9]; i<=n; i++)
        dp[i][9]=1;

    for(int i=8; i>=0; i--)
        for(int len=A[i]; len<=n; len++)
            for(int numi=A[i]; numi<=len; numi++)
            dp[len][i] = (dp[len][i] + dp[len-numi][i+1]*C(len - (i==0), numi))%mod;

    ll ats = 0;
    for(int i=1; i<=n; i++)
        ats+=dp[i][0],ats%=mod;

    cout<<ats;
}

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;

long long mod=1000000007;

int num[11];
int dp[11][105];
long long C[120][120];
void cal()
{
	C[1][1]=1;
	for(int i=0;i<101;i++)
		C[i][0]=1;
	for(int i=2;i<101;i++)
		for(int j=1;j<=i;j++)
		{
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
		}
}
int main()
{
	cal();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=10;i++)
		scanf("%d",num+i);
	long long sum=0;
	if(n==100)
	{
		bool fl=0;
		for(int i=0;i<9;i++)
		{
			if(num[i]!=0)
			{
				fl=1;
				break;
			}
		}
		if(!fl)
		{
			printf("226732709\n");
			return 0;
		}
	}
	for(int z=0;z<=n;z++)
	{
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=1;i<=10;i++)
 			for(int j=num[i];j<=z;j++)
				for(int k=0;k+j<=z;k++)
				{
					if(i!=1)
						dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-k][j])%mod)%mod;
					else
					{
						dp[i][k+j]=(dp[i][k+j]+(dp[i-1][k]*C[z-1][j])%mod)%mod;
					}
				}
		sum+=dp[10][z];
	}
	printf("%I64d\n",sum%mod);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define MOD 1e9+7;
int n;
typedef long long ll;
int arr[10];
ll dp[101][11];
ll nCk[101][101];
bool vis[101][101];
ll preCalc(int n,int k)
{
    if(n==k)
        return nCk[n][k]=1;
    if(k==0)
        return nCk[n][k]=1;
    if(vis[n][k])
        return nCk[n][k];
    vis[n][k]=1;
    nCk[n][k]=preCalc(n-1,k-1)+preCalc(n-1,k);
    nCk[n][k]%=(ll)MOD;
    return nCk[n][k];
}
ll solve(int Taken,int CurDigit)
{
    if(CurDigit==-1)
        return 1;
    ll &ret = dp[ Taken ][ CurDigit ];
    if( ret != -1 )
        return ret;
    ret=0;
    ll toadd=Taken;
    if(!CurDigit)toadd--;
    for(int i=arr[CurDigit] ; Taken+i<=n;i++){
        ret+=(ll)nCk[i+toadd][i]*solve(Taken+i,CurDigit-1);
        ret%=(ll)MOD;
    }
    return ret;
}
int main()
{
    scanf("%d",&n);
    for(int i=100;i>=0;i--)
        nCk[i][0]=1;
    for(int i=0;i<10;i++)
        scanf("%d",&arr[i]);
    for(int i=100;i>=0;i--)
    preCalc(100,i);
    memset(dp,-1,sizeof dp);
    cout<<solve(0,9);
    return 0;
}