#include <bits/stdc++.h>
using namespace std;
template <typename T>
using vc = vector<T>;
using pii = pair<long long, long long>;
void xmax(long long& a, long long b) { a = max(a, b); }
void xmin(long long& a, long long b) { a = min(a, b); }
void print(vc<long long>& a, string second) {
  cerr << second << " : ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  cerr << endl;
}
long long mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vc<long long> a(10);
  for (long long i = 0; i < 10; i++) cin >> a[i];
  vc<long long> mit_l(n + 1);
  vc<long long> ohne_l(n + 1);
  for (long long j = a[0]; j < n + 1; j++) mit_l[j] = 1;
  vc<vc<long long> > binom(2 * n + 5, vc<long long>(2 * n + 5));
  for (long long i = 0; i < n + 1; i++) {
    binom[i][i] = 1;
    binom[i][0] = 1;
  }
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 1; j < i; j++) {
      binom[i][j] = (binom[i - 1][j] + binom[i - 1][j - 1]) % mod;
    }
  }
  for (long long digit = 1; digit < 10; digit++) {
    vc<long long> next_mit(n + 1);
    vc<long long> next_ohne(n + 1);
    for (long long i = a[digit]; i < n + 1; i++) {
      for (long long l = 0; l < n + 1; l++) {
        if (l - i < 0) continue;
        long long add_ohne1;
        if (i == 0)
          add_ohne1 = 0;
        else
          add_ohne1 = mit_l[l - i] * binom[l - 1][i - 1] % mod;
        long long add_ohne2 = ohne_l[l - i] * binom[l][i] % mod;
        next_ohne[l] = (next_ohne[l] + add_ohne1 + add_ohne2) % mod;
        long long add_mit;
        if (l == 0)
          add_mit = mit_l[0];
        else
          add_mit = mit_l[l - i] * binom[l - 1][i] % mod;
        next_mit[l] = (next_mit[l] + add_mit) % mod;
      }
    }
    mit_l = next_mit;
    ohne_l = next_ohne;
    next_mit = vc<long long>(n + 1);
    next_ohne = vc<long long>(n + 1);
  }
  long long sum = 0;
  for (long long i = 0; i < n + 1; i++) {
    sum += ohne_l[i];
  }
  cout << sum % mod << "\n";
}
