#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void Print() { cout << endl; }
template <typename T1, typename... T>
void Print(const T1 &t1, const T &...t) {
  cout << t1 << " ";
  Print(t...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class Iterator>
ostream &output_cantainer(ostream &os, Iterator first, Iterator last,
                          bool space = true) {
  if (space) {
    for (Iterator it = first; it != last; it++) {
      os << (*it) << ' ';
    }
    os << endl;
  } else
    for (Iterator it = first; it != last; it++) {
      os << (*it) << endl;
    }
  return os;
}
const int V = 10, M = 1e9 + 7, N = 105;
int a[V], n, ans, c[N], c1[N];
int fac[N], rfac[N];
int rev(int a) {
  int ret = 1;
  for (int b = M - 2; b; b >>= 1, a = (LL)a * a % M) {
    if (b & 1) ret = (LL)ret * a % M;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < V; i++) scanf("%d", a + i);
  fac[0] = rfac[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = (LL)fac[i - 1] * i % M;
    rfac[i] = (LL)rfac[i - 1] * rev(i) % M;
  }
  c[0] = 1;
  for (int i = 0; i < V; i++) {
    memset(c1, 0, sizeof(c1));
    for (int j = a[i]; j <= n; j++) {
      for (int k = a[i]; k <= j; k++) {
        c1[j] += (LL)c[j - k] * rfac[k] % M;
        c1[j] %= M;
      }
    }
    memcpy(c, c1, sizeof(c1));
  }
  int v1 = 0;
  for (int i = 1; i <= n; i++) {
    v1 += (LL)c[i] * fac[i] % M;
    v1 %= M;
  }
  memset(c, 0, sizeof(c));
  c[0] = 1;
  a[0] = max(a[0] - 1, 0);
  for (int i = 0; i < V; i++) {
    memset(c1, 0, sizeof(c1));
    for (int j = a[i]; j <= n - 1; j++) {
      for (int k = a[i]; k <= j; k++) {
        c1[j] += (LL)c[j - k] * rfac[k] % M;
        c1[j] %= M;
      }
    }
    memcpy(c, c1, sizeof(c1));
  }
  int v2 = 0;
  for (int i = 0; i <= n - 1; i++) {
    v2 += (LL)c[i] * fac[i] % M;
    v2 %= M;
  }
  printf("%d\n", (v1 - v2 + M) % M);
}
