#include <bits/stdc++.h>
using namespace std;
const int N = 101;
const long long mod = 1e9 + 7;
int n;
int a[10];
long long fac[N], inv[N];
long long f[N][10];
int Pow(long long a, int k) {
  long long res = 1;
  for (; k; k >>= 1, a = a * a % mod)
    if (k & 1) res = res * a % mod;
  return res;
}
int C(int k, int n) { return (inv[k] * inv[n - k] % mod) * fac[n] % mod; }
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i <= 9; ++i) cin >> a[i];
  int sum = accumulate(a, a + 10, 0);
  if (sum > n) {
    cout << 0;
    return 0;
  }
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % mod;
  inv[n] = Pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % mod;
  for (int len = a[9]; len <= n; ++len) f[len][9] = 1;
  long long res = 0;
  for (int len = 0; len <= n; ++len) {
    for (int i = 8; i >= 0; --i) {
      for (int j = a[i]; j <= len; ++j)
        f[len][i] += f[len - j][i + 1] * C(j, len - (i == 0)) % mod;
      f[len][i] %= mod;
    }
    if (len >= sum) res += f[len][0];
  }
  cout << res % mod;
  return 0;
}
