#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
int n, a[10], f[105][10], C[105][105];
int main() {
  scanf("%d", &n);
  for (int i = (0); i <= (9); ++i) scanf("%d", &a[i]);
  for (int i = (0); i <= (n); ++i) {
    C[i][0] = 1;
    for (int j = (1); j <= (i); ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007;
  }
  for (int len = (0); len <= (n); ++len) {
    f[len][9] = (len >= a[9]);
    for (int d = (8); d >= (1); --d) {
      for (int k = (a[d]); k <= (len); ++k)
        f[len][d] =
            (f[len][d] + (long long)f[len - k][d + 1] * C[len][k]) % 1000000007;
    }
    if (len > 0)
      for (int k = (a[0]); k <= (len); ++k)
        f[len][0] =
            (f[len][0] + (long long)f[len - k][1] * C[len - 1][k]) % 1000000007;
  }
  int ans = 0;
  for (int i = (0); i <= (n); ++i) ans = (ans + f[i][0]) % 1000000007;
  printf("%d", ans);
  return 0;
}
