#include <bits/stdc++.h>
using namespace std;
long long d[10];
long long mem[105][15][15];
long long mod = 1e9 + 7;
long long ncr[105][105];
long long get_ncr(long long n, long long r) {
  if (n < r) return 0;
  if (n == r || r == 0) return 1;
  if (ncr[n][r] != -1) return ncr[n][r];
  ncr[n][r] = get_ncr(n - 1, r - 1) + get_ncr(n - 1, r);
  ncr[n][r] %= mod;
  return ncr[n][r];
}
long long doit(long long id, long long dg, long long fd) {
  if (id < 0) return 0;
  long long i;
  if (id == 0) {
    for (i = dg; i <= 9; i++)
      if ((d[i] && fd != i) || (fd == i && d[i] > 1)) return 0;
    return 1;
  }
  if (dg > 9) return 0;
  long long rt = 0, rr = d[dg];
  if (dg == fd) rr = max(0LL, rr - 1);
  if (dg <= 9 && id < rr) return 0;
  if (mem[id][dg][fd] != -1) return mem[id][dg][fd];
  for (i = rr; i <= id; i++) {
    rt += get_ncr(id, i) * doit(id - i, dg + 1, fd);
    rt %= mod;
  }
  return mem[id][dg][fd] = rt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, x, y, n, m, cnt = 0, k, g, flg, t, a, b;
  memset(mem, -1, sizeof(mem));
  memset(ncr, -1, sizeof(ncr));
  cin >> n;
  for (i = 0; i <= 9; i++) {
    cin >> d[i];
    cnt += d[i];
  }
  long long an = 0;
  for (i = cnt; i <= n; i++) {
    for (j = 1; j <= 9; j++) {
      x = doit(i - 1, 0, j);
      an += doit(i - 1, 0, j);
      an %= mod;
    }
  }
  cout << an << endl;
}
