#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-8;
const long double PI = 3.1415926535897932384626433832795;
const long double E = 2.7182818284;
const int INF = 1000000000;
const long long mod = 1000000007;
int main(void) {
  int n, i, j, g;
  int a[10];
  cin >> n;
  for (int i = 0; i < int(10); i++) cin >> a[i];
  long long pascal[n + 1][n + 1];
  pascal[0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (int j = 0; j < int(n + 1); j++) {
      if (j > i)
        pascal[i][j] = 0;
      else if (j == 0 || j == i)
        pascal[i][j] = 1;
      else
        pascal[i][j] = pascal[i - 1][j - 1] + pascal[i - 1][j];
      pascal[i][j] %= mod;
    }
  }
  long long dp[n + 1][10];
  for (int i = 0; i < int(n + 1); i++) {
    for (int j = 0; j < int(10); j++) dp[i][j] = 0;
  }
  for (int i = 0; i < int(n + 1); i++) {
    if (i >= a[9])
      dp[i][9] = 1;
    else
      dp[i][9] = 0;
  }
  for (j = 8; j > 0; j--) {
    for (int i = 0; i < int(n + 1); i++) {
      if (i < a[j])
        dp[i][j] = 0;
      else {
        for (g = i - a[j]; g >= 0; g--) {
          dp[i][j] += dp[g][j + 1] * pascal[i][i - g];
          dp[i][j] %= mod;
        }
      }
    }
  }
  for (int i = 0; i < int(n + 1); i++) {
    if (i < a[0])
      dp[i][0] = 0;
    else {
      for (g = i - a[0]; g > 0; g--) {
        dp[i][0] += dp[g][1] * pascal[i - 1][i - g];
        dp[i][0] %= mod;
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < int(n + 1); i++) {
    res += dp[i][0];
    res %= mod;
  }
  cout << res;
  return 0;
}
