#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e3 + 5;
const double eps = 1e-9;
using namespace std;
int a[10];
long long fac[MAXN], dp[MAXN][10];
long long bin_pow(long long x, long long y) {
  long long r = 1;
  while (y) {
    if (y & 1) r = (r * x) % MOD;
    x = (x * x) % MOD;
    y /= 2;
  }
  return r;
}
long long ncr(int n, int k) {
  return (fac[n] * bin_pow(fac[k], MOD - 2) % MOD) *
         bin_pow(fac[n - k], MOD - 2) % MOD;
}
int main() {
  int n;
  scanf("%d", &(n));
  for (int i = 0; i < (10); i++) scanf("%d", &(a[i]));
  fac[0] = 1;
  for (long long i = 1; i <= 100; i++) fac[i] = fac[i - 1] * i % MOD;
  long long s = 0;
  for (int i = 0; i < 10; i++) s += a[i];
  if (s > n) return !printf("%d\n", (0));
  for (int i = 9; i >= 0; i--) {
    for (int j = 0; j <= n; j++) {
      if (i == 9 && j < a[9])
        dp[j][i] = 0;
      else if (i == 9)
        dp[j][i] = 1;
      else if (i == 0) {
        for (int k = a[i]; k <= j; k++)
          dp[j][i] = (dp[j][i] + dp[j - k][i + 1] * ncr(j - 1, k) % MOD) % MOD;
      } else {
        for (int k = a[i]; k <= j; k++)
          dp[j][i] = (dp[j][i] + dp[j - k][i + 1] * ncr(j, k) % MOD) % MOD;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[i][0]) % MOD;
  printf("%I64d\n", (ans));
  return 0;
}
