#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, a[10], C[110][110], dp[110][10], ans;
inline long long add(long long x, long long y) {
  x += y;
  if (x > MOD) x -= MOD;
  return x;
}
inline long long mul(long long x, long long y) {
  x *= y;
  if (x > MOD) x %= MOD;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  cin >> n;
  for (int i = 0; i < 10; ++i) cin >> a[i];
  C[0][0] = 1;
  for (int i = 1; i <= 100; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j) C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
  }
  for (int i = a[9]; i <= n; ++i) dp[i][9] = 1;
  for (int i = 0; i <= n; ++i) {
    for (int j = 8; j > 0; --j)
      for (int k = a[j]; k <= i; ++k)
        dp[i][j] = add(dp[i][j], mul(dp[i - k][j + 1], C[i][k]));
    for (int j = a[0]; j < i; ++j)
      dp[i][0] = add(dp[i][0], mul(dp[i - j][1], C[i - 1][j]));
  }
  for (int i = 0; i <= n; ++i) ans = add(ans, dp[i][0]);
  cout << ans << '\n';
}
