#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
vector<long long> sil(101);
long long Pow(long long a, long long w) {
  if (w == 1) return a;
  if (w % 2 == 1) return a * Pow(a, w - 1) % MOD;
  long long x = Pow(a, w / 2);
  return x * x % MOD;
}
long long Inv(long long x) { return Pow(x, MOD - 2); }
long long C(long long n, long long k) {
  return sil[n] * Inv(sil[n - k] * sil[k] % MOD) % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  sil[0] = 1;
  for (long long i = 1; i < 101; ++i) sil[i] = (sil[i - 1] * i) % MOD;
  vector<int> a(10);
  for (int i = 0; i < 10; ++i) cin >> a[i];
  vector<vector<long long> > dp(10, vector<long long>(n + 1, 0));
  for (int i = max(a[9], 1); i <= n; ++i) dp[9][i] = 1;
  for (int c = 9; c > 0; --c) {
    for (int i = 1; i <= n; ++i) {
      for (int j = max(a[c - 1], 1); i + j <= n; ++j) {
        long long wlk = (c == 1) ? i + j - 1 : i + j;
        dp[c - 1][i + j] = (dp[c - 1][i + j] + dp[c][i] * C(wlk, j)) % MOD;
      }
      if (a[c - 1] == 0) dp[c - 1][i] = (dp[c - 1][i] + dp[c][i]) % MOD;
    }
    bool zera = true;
    for (int i = c; i < 10; ++i)
      if (a[i] != 0) zera = false;
    if (zera && c != 1)
      for (int i = max(a[c - 1], 1); i <= n; ++i)
        dp[c - 1][i] = (dp[c - 1][i] + 1) % MOD;
  }
  long long odp = 0;
  for (int i = 1; i <= n; ++i) odp = (odp + dp[0][i]) % MOD;
  cout << odp;
  return 0;
}
