#include <bits/stdc++.h>
using namespace std;
int dp[12][105], ar[12], combi[120][120];
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 10; ++i) cin >> ar[(i + 9) % 10 + 1];
  dp[0][0] = 1;
  for (int i = 0; i <= 102; ++i) combi[i][i] = combi[i][0] = 1;
  for (int i = 2; i <= 100; ++i)
    for (int j = 1; j < i; ++j)
      combi[i][j] = (combi[i - 1][j - 1] + combi[i - 1][j]) % mod;
  for (int i = 1; i <= 10; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = ar[i]; i < 10 ? k <= j : k < j; ++k)
        dp[i][j] =
            (dp[i][j] + 1LL * dp[i - 1][j - k] * combi[i < 10 ? j : j - 1][k]) %
            mod;
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; ++i) sum = (sum + dp[10][i]) % mod;
  cout << sum << endl;
}
