#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX_N = 102;
int a[10];
int dp[10][MAX_N][MAX_N], dp1[MAX_N][MAX_N];
int binpow(int a, int p) {
  if (p == 0) return 1;
  if (p % 2) return binpow(a, p - 1) * 1ll * a % MOD;
  int b = binpow(a, p / 2);
  return b * 1ll * b % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<long long> inv(MAX_N), fact(MAX_N), fact_inv(MAX_N);
  inv[1] = 1;
  for (int i = 2; i < MAX_N; i++) {
    inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
  }
  fact[0] = fact_inv[0] = 1;
  for (int i = 1; i < MAX_N; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
  }
  auto C = [fact, fact_inv](int n, int k) {
    if (k > n || n < 0) return 0ll;
    return fact[n] * fact_inv[k] % MOD * fact_inv[n - k] % MOD;
  };
  int n;
  cin >> n;
  for (int i = 0; i <= 9; ++i) cin >> a[i];
  for (int tot_len = 0; tot_len <= n; ++tot_len)
    for (int first_dig_use = a[1]; first_dig_use <= tot_len; ++first_dig_use)
      dp[1][tot_len][first_dig_use] = C(tot_len, first_dig_use);
  for (int cur_dig = 2; cur_dig <= 9; ++cur_dig)
    for (int tot_len = 1; tot_len <= n; ++tot_len)
      for (int already_used = 0; already_used <= tot_len; ++already_used)
        for (int cur_dig_use = a[cur_dig];
             cur_dig_use + already_used <= tot_len; ++cur_dig_use) {
          dp[cur_dig][tot_len][already_used + cur_dig_use] +=
              dp[cur_dig - 1][tot_len][already_used] *
              C(tot_len - already_used, cur_dig_use) % MOD;
          dp[cur_dig][tot_len][already_used + cur_dig_use] %= MOD;
        }
  dp1[0][0] = 1;
  for (int tot_pos = 1; tot_pos < MAX_N; ++tot_pos)
    for (int zeros_cnt = 0; zeros_cnt < MAX_N; ++zeros_cnt)
      for (int cur_zeros_cnt = 0; cur_zeros_cnt <= zeros_cnt; ++cur_zeros_cnt) {
        dp1[tot_pos][zeros_cnt] += dp1[tot_pos - 1][zeros_cnt - cur_zeros_cnt];
        dp1[tot_pos][zeros_cnt] %= MOD;
      }
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    int min_zeros = a[0], max_zeros = n - i;
    for (int zeros = min_zeros; zeros <= max_zeros; ++zeros) {
      ans += dp1[i][zeros] * 1ll * dp[9][i][i] % MOD;
      ans %= MOD;
    }
  }
  cout << ans;
  return 0;
}
