#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000000 + 7;
const long long int N = 300000 + 5;
const long long int M = 3e5 + 3;
long long int fac[1000005];
long long int inv_of_fac[1000005];
long long int qpow(long long int x, long long int n) {
  long long int ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * x % mod;
    x = x * x % mod;
  }
  return ret;
}
void init() {
  fac[1] = 1;
  for (int i = 2; i <= M; i++) fac[i] = fac[i - 1] * i % mod;
  inv_of_fac[M] = qpow(fac[M], mod - 2);
  for (int i = M - 1; i >= 0; i--)
    inv_of_fac[i] = inv_of_fac[i + 1] * (i + 1) % mod;
}
long long int C(long long int a, long long int b) {
  if (b > a) return 0;
  if (b == 0) return 1;
  return fac[a] * inv_of_fac[b] % mod * inv_of_fac[a - b] % mod;
}
int a[15];
long long int dp[150][12];
int main() {
  init();
  int n;
  while (~scanf("%d", &n)) {
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i <= 9; i++) scanf("%d", &a[i]);
    for (int i = a[9]; i <= n; i++) dp[i][9] = 1;
    for (int i = 8; i >= 0; i--) {
      for (int j = 0; j <= n; j++) {
        for (int k = a[i]; k <= j; k++) {
          if (i != 0)
            dp[j][i] = (dp[j][i] + dp[j - k][i + 1] * C(j, k)) % mod;
          else if (i == 0 && j > k) {
            dp[j][i] = (dp[j][i] + dp[j - k][i + 1] * C(j - 1, k)) % mod;
          }
        }
      }
    }
    long long int ans = 0;
    for (int i = 0; i <= n; i++) ans = (ans + dp[i][0]) % mod;
    printf("%I64d\n", ans);
  }
}
