#include <bits/stdc++.h>
using namespace std;
const int MN = 1e2 + 10;
const int MOD = 1e9 + 7;
int digit[20];
long long dp[MN][20];
long long c[MN][MN];
int n;
long long ans;
void prep() {
  c[0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= i; ++j) {
      if (j == 0)
        c[i][j] = 1;
      else
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
    }
  dp[0][10] = 1;
  for (int i = 0; i <= n; ++i)
    for (int j = 9; j >= 0; --j) {
      for (int k = digit[j]; k <= i; ++k) {
        dp[i][j] += (1ll * c[i][k] * dp[i - k][j + 1]) % MOD;
        dp[i][j] %= MOD;
      }
    }
}
void solve() {
  for (int i = 1; i <= n; ++i) {
    for (int k = digit[0] - 1; k < i; ++k) {
      ans -= (1ll * c[i - 1][k] * dp[i - k - 1][1]) % MOD;
      ans = (ans + MOD) % MOD;
    }
    ans += dp[i][0];
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 0; i < 10; ++i) cin >> digit[i];
  prep();
  solve();
  return 0;
}
