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