#include <bits/stdc++.h>
using namespace std;
int z[10];
long long f[5000];
int dp[1000][1000];
const int mod = int(1e9) + 7;
long long mod_pow(long long a, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    n /= 2;
  }
  return res;
}
long long c(long long n, long long k) {
  long long res = f[n];
  res *= mod_pow(f[k], mod - 2);
  res %= mod;
  res *= mod_pow(f[n - k], mod - 2);
  res %= mod;
  return res;
}
int main() {
  f[0] = 1;
  for (int i = 1; i < 1000; i++) f[i] = (f[i - 1] * i) % mod;
  int n;
  cin >> n;
  for (int i = 0; i < 10; i++) cin >> z[i];
  reverse(z, z + 10);
  for (int i = z[0]; i <= n; i++) dp[0][i] = 1;
  for (int i = 1; i < 10; i++)
    for (int len = 0; len <= n; len++)
      if (i == 9 && len == 0)
        continue;
      else
        for (int curr_len = z[i]; curr_len + len <= n; curr_len++) {
          int q = 0;
          if (i == 9) q = 1;
          dp[i][len + curr_len] +=
              (dp[i - 1][len] * c(len + curr_len - q, curr_len)) % mod;
          dp[i][len + curr_len] %= mod;
        }
  long long res = 0;
  for (int i = 0; i <= n; i++) res += dp[9][i];
  cout << res % mod << endl;
  return 0;
}
