#include <bits/stdc++.h>
using namespace std;
template <class _T>
inline _T sqr(const _T& x) {
  return x * x;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
const long double EPS = 1e-11;
char TEMPORARY_CHAR;
const int INF = 0x3f3f3f3f;
const int N = 1 << 16;
inline void input(int& a) {
  a = 0;
  while ((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') {
  }
  while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {
    a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0';
    TEMPORARY_CHAR = getchar();
  }
}
long long dp[110][10];
long long c[110][110];
long long mod = 1000000007;
int main() {
  memset((c), 0, sizeof(c));
  c[0][0] = 1;
  for (int i = 1; i <= 109; i++)
    for (int j = 0; j < (int)(101); j++)
      for (int k = 0; k < (int)(j + 1); k++)
        c[i][j] = (c[i][j] + c[i - 1][j - k]) % mod;
  int(n);
  input((n));
  ;
  int a[10];
  for (int i = 0; i < (int)(10); i++) input(a[i]);
  long long s = 0;
  long long ans = 0;
  for (int i = 0; i < (int)(n + 1); i++) {
    dp[i][9] = 0;
    if (i >= a[9]) dp[i][9] = 1;
    for (int j = 8; j > 0; j--) {
      dp[i][j] = 0;
      for (int k = a[j]; k <= i; k++)
        dp[i][j] =
            (dp[i][j] + ((dp[i - k][j + 1] * c[i - k + 1][k]) % mod)) % mod;
    }
    dp[i][0] = 0;
    for (int k = a[0]; k <= i; k++)
      dp[i][0] = (dp[i][0] + ((dp[i - k][1] * c[i - k][k]) % mod)) % mod;
    s += dp[i][0];
    if (i) ans = (ans + dp[i][0]) % mod;
  }
  cout << ans % mod;
  return 0;
}
