#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> a(10);
  for (int i = 0; i <= 9; ++i) cin >> a[i];
  vector<vector<long long> > f(11, vector<long long>(n + 1));
  f[10][0] = 1;
  vector<vector<int> > co(n + 1, vector<int>(n + 1));
  for (int i = 0; i <= n; ++i) {
    co[i][0] = 1;
    for (int j = 1; j <= i; ++j)
      co[i][j] = (co[i - 1][j] + co[i - 1][j - 1]) % mod;
  }
  for (int c = 9; c >= 0; --c)
    for (int i = n; i >= 0; --i)
      for (int j = i - a[c]; j >= 0; --j) {
        if (c > 0)
          f[c][i] = (f[c][i] + f[c + 1][j] * co[i][j]) % mod;
        else if (i > 0 && j > 0)
          f[c][i] = (f[c][i] + f[c + 1][j] * co[i - 1][j - 1]) % mod;
      }
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    ans += f[0][i];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
