#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 5;
const long long MOD = 1e9 + 7;
long long f[MAXN], fr[MAXN];
int a[20];
long long c[120][120];
long long dp[MAXN][10];
long long bin_pow(long long a, long long st) {
  long long ans = 1;
  for (; st; st >>= 1) {
    if (st & 1) ans = (ans * a + MOD) % MOD;
    a = (a * a + MOD) % MOD;
  }
  return ans;
}
void solve() {
  int n;
  scanf("%d", &n);
  f[0] = fr[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = (f[i - 1] * i + MOD) % MOD;
    fr[i] = bin_pow(f[i], MOD - 2);
  }
  for (int i = 0; i < 10; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i <= n; i++) {
    c[i][0] = c[i][i] = 1;
    for (int j = 0; j < i; j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
    }
  }
  long long cnk, cur;
  for (int len = 0; len <= n; len++) {
    dp[len][9] = (a[9] <= len) ? 1 : 0;
    for (int d = 8; d >= 0; d--) {
      dp[len][d] = 0;
      for (int k = a[d]; k <= len; k++) {
        int len2 = len;
        if (!d && k) len2--;
        cur = (dp[len - k][d + 1] * c[len2][k] + MOD) % MOD;
        dp[len][d] = (dp[len][d] + cur + MOD) % MOD;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + dp[i][0] + MOD) % MOD;
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
