#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int MOD = 1000000007;
long long fat[N];
int v[11], n;
long long dp[110][11];
long long dp0[110][110];
long long fpow(long long base, long long exp) {
  if (!exp) return 1LL;
  long long r = fpow(base, exp / 2);
  if (exp % 2) return (base * ((r * r) % MOD)) % MOD;
  return (r * r) % MOD;
}
long long comb(int num, int den) {
  long long cima = fat[num];
  long long baixo = (fat[den] * fat[num - den]) % MOD;
  return (cima * fpow(baixo, MOD - 2)) % MOD;
}
long long solve(int k, int at) {
  if (at == 10 and k) return 0;
  if (!k) {
    for (int j = at; j <= 9; j++) {
      if (v[j]) return 0;
    }
    return 1;
  }
  long long &ret = dp[k][at];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = v[at]; i <= k; i++) {
    ret += (comb(k, i) * solve(k - i, at + 1)) % MOD;
    ret %= MOD;
  }
  return ret;
}
long long solve0(int k, int qtd) {
  int at = 0;
  if (at == 10 and k) return 0;
  if (!k) {
    for (int j = at; j <= 9; j++) {
      if (v[j]) return 0;
    }
    return 1;
  }
  long long &ret = dp0[k][qtd];
  if (ret != -1) return ret;
  ret = 0;
  if (k - 2 - qtd < 0 and v[at] <= qtd) {
    return ret = solve(k - qtd, at + 1);
  }
  for (int i = max(0, v[at] - qtd); i <= k - 2 - qtd; i++) {
    ret += (comb(k - 2 - qtd, i) * solve(k - i - qtd, at + 1)) % MOD;
    ret %= MOD;
  }
  return ret;
}
int main(void) {
  memset(dp, -1, sizeof dp);
  memset(dp0, -1, sizeof dp0);
  fat[0] = 1;
  for (int i = 1; i <= 110; i++) {
    fat[i] = (fat[i - 1] * i) % MOD;
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 10; i++) {
    scanf("%d", v + i);
  }
  long long resp = 0;
  for (int j = n; j >= 1; j--) {
    for (int i = 0; i < j; i++) {
      resp += solve0(j, i);
      resp %= MOD;
    }
  }
  cout << resp << endl;
  return 0;
}
