#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
const long long mod = 1000 * 1000 * 1000 + 7;
long long C[111][111];
long long a[11];
long long dp[111][11];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  srand(__rdtsc());
  int n;
  cin >> n;
  for (int i = 0; i < 10; i++) cin >> a[i];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      if (i == j || j == 0)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  for (int len = 0; len <= n; len++) {
    if (len >= a[9])
      dp[len][9] = 1;
    else
      dp[len][9] = 0;
    for (int j = 8; j > 0; j--)
      for (int i = a[j]; i <= len; i++) {
        dp[len][j] += dp[len - i][j + 1] * C[len][i];
        dp[len][j] %= mod;
      }
    for (int i = a[0]; i <= len; i++) {
      dp[len][0] += dp[len - i][1] * C[len - 1][i];
      dp[len][0] %= mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[i][0]) % mod;
  ans %= mod;
  ans += mod;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
