#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e3 + 10;
const int maxm = 5e5 + 10;
const long long INF = 1e18;
long long powmod(long long x, long long y) {
  long long t;
  for (t = 1; y; y >>= 1, x = x * x % mod)
    if (y & 1) t = t * x % mod;
  return t;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int n, a[maxn], sum = 0;
long long dp[maxn], dp2[maxn], ans = 0;
long long fac[maxn], inv[maxn];
long long C(int x, int y) {
  if (x < y) return 0;
  return fac[x] * inv[y] % mod * inv[x - y] % mod;
}
int main() {
  ios::sync_with_stdio(false);
  fac[0] = 1;
  for (int(i) = (1); (i) < (maxn); (i)++) fac[i] = (fac[i - 1] * i) % mod;
  inv[maxn - 1] = powmod(fac[maxn - 1], mod - 2);
  for (int i = maxn - 2; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
  cin >> n;
  for (int(i) = (0); (i) < (10); (i)++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int(i) = (1); (i) < (10); (i)++) {
    a[i]--, n--;
    memset((dp), (0), sizeof(dp)), dp[0] = 1;
    for (int(j) = (0); (j) < (10); (j)++) {
      memset((dp2), (0), sizeof(dp2));
      for (int(k) = (max(0, a[j])); (k) < (n + 1); (k)++)
        for (int(p) = (k); (p) < (n + 1); (p)++)
          (dp2[p] += dp[p - k] * C(p, k) % mod) %= mod;
      memcpy(dp, dp2, sizeof(dp));
    }
    long long tmp = 0;
    for (int(j) = (0); (j) < (n + 1); (j)++) (tmp += dp[j]) %= mod;
    (ans += tmp) %= mod;
    a[i]++, n++;
  }
  if ((sum == 1 && a[0] == 1)) ans = (ans + 1) % mod;
  cout << ans << "\n";
  return 0;
}
