#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int a[10], suff[10], fact[111], invfact[111];
int DP[11][101];
int poww(int base, int exp) {
  int res = 1;
  while (exp) {
    if (exp & 1) res = res * (long long)base % MOD;
    base = base * (long long)base % MOD;
    exp >>= 1;
  }
  return res;
}
void pre() {
  fact[0] = 1;
  for (int i = 1; i < 111; i++) fact[i] = i * (long long)fact[i - 1] % MOD;
  for (int i = 0; i < 111; i++) invfact[i] = poww(fact[i], MOD - 2);
}
int main() {
  pre();
  int n;
  cin >> n;
  for (int i = 0; i < 10; i++) cin >> a[i];
  suff[9] = a[9];
  for (int i = 8; i >= 0; i--) suff[i] = a[i] + suff[i + 1];
  if (suff[0] > n) {
    cout << 0 << '\n';
    return 0;
  }
  int digs = n - suff[0];
  DP[10][0] = 1;
  for (int i = 9; i >= 0; i--) {
    for (int dig = 0; dig <= digs; dig++) {
      int& ret = DP[i][dig];
      int N = suff[i] + dig;
      for (int times = 0; times <= dig; times++) {
        int trf = (fact[N] * (long long)invfact[N - a[i] - times]) % MOD *
                  (long long)invfact[a[i] + times] % MOD;
        ret += trf * (long long)DP[i + 1][dig - times] % MOD;
        if (ret >= MOD) ret -= MOD;
      }
    }
  }
  int totCnt = 0;
  for (int used = 0; used <= digs; used++) {
    int suffSum = 0, cnt = 0;
    for (int pref = a[0] + used; pref > used; pref--) {
      int other = a[0] + used - pref;
      int nowCnt = (fact[other + suff[1] + digs - used] *
                    (long long)invfact[suff[1] + digs - used] % MOD *
                    (long long)invfact[other] % MOD) *
                   (long long)DP[1][digs - used] % MOD;
      nowCnt = (nowCnt - suffSum + MOD) % MOD;
      cnt += nowCnt;
      if (cnt >= MOD) cnt -= MOD;
      suffSum += nowCnt;
      if (suffSum >= MOD) suffSum -= MOD;
    }
    totCnt += cnt;
    if (totCnt >= MOD) totCnt -= MOD;
  }
  if (digs == n) {
    ++totCnt;
    if (totCnt >= MOD) totCnt -= MOD;
  }
  cout << (DP[0][digs] - totCnt + MOD) % MOD << '\n';
  return 0;
}
