#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
const long long mod = 1e9 + 7, N = 1000 + 7;
long long dp[N][N], c[N][N], a[N];
int32_t main() {
  long long n = in();
  for (long long i = 0; i <= 9; i++) a[i] = in();
  for (long long i = 0; i < N; i++) {
    c[0][i] = 1;
    for (long long k = 1; k <= i; k++)
      c[k][i] = (c[k][i - 1] + c[k - 1][i - 1]) % mod;
  }
  long long sigma = 0;
  dp[10][0] = 1;
  for (long long i = 9; i >= 0; i--) {
    sigma += a[i];
    for (long long j = sigma; j <= n; j++) {
      if (i)
        for (long long k = a[i]; k <= j; k++)
          (dp[i][j] += dp[i + 1][j - k] * 1ll * c[k][j]) %= mod;
      else
        for (long long k = a[i]; k < j; k++)
          (dp[i][j] += dp[i + 1][j - k] * 1ll * c[k][j - 1]) %= mod;
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = (ans + dp[0][i]) % mod;
  cout << ans << endl;
}
