Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it.

There is integer n and array a, consisting of ten integers, indexed by numbers from 0 to 9. Your task is to count the number of positive integers with the following properties:

  * the number's length does not exceed n; 
  * the number doesn't have leading zeroes; 
  * digit i (0 ≤ i ≤ 9) occurs in the number at least a[i] times. 

Input

The first line contains integer n (1 ≤ n ≤ 100). The next line contains 10 integers a[0], a[1], ..., a[9] (0 ≤ a[i] ≤ 100) — elements of array a. The numbers are separated by spaces.

Output

On a single line print the remainder of dividing the answer to the problem by 1000000007 (109 + 7).

Examples

Input

1
0 0 0 0 0 0 0 0 0 1


Output

1


Input

2
1 1 0 0 0 0 0 0 0 0


Output

1


Input

3
1 1 0 0 0 0 0 0 0 0


Output

36

Note

In the first sample number 9 meets the requirements.

In the second sample number 10 meets the requirements.

In the third sample numbers 10, 110, 210, 120, 103 meet the requirements. There are other suitable numbers, 36 in total.
#include <bits/stdc++.h>
using namespace std;
const long long M = 5205;
const long long INF = 1e15 + 5;
const long long MOD = 1e9 + 7;
const long long N = 2e5;
const double PI = 3.14159265358979323846264338327950288419716939937510;
long long n, a[11], ans, t, dp[105][15], fact[105];
int c[105][105];
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long i) { return power(i, MOD - 2, MOD); }
long long C(long long af, long long b) {
  if (af < b) return 0;
  if (b == 0) return 1;
  return (fact[af] * modInverse(fact[b]) % MOD * modInverse(fact[af - b]) %
          MOD) %
         MOD;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  fact[0] = 1;
  for (long long i = 1; i <= n; i++) fact[i] = (fact[i - 1] * i) % MOD;
  c[0][0] = 1;
  for (int i = 0; i <= 100; i++)
    for (int j = 0; j <= i; j++)
      if (j == 0)
        c[i][j] = 1;
      else
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
  for (long long i = 0; i <= 9; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i <= n; i++) {
    for (long long j = 9; j >= 0; j--) {
      if (j == 9) {
        if (i < a[j])
          dp[i][j] = 0;
        else
          dp[i][j] = 1;
      } else if (j == 0) {
        for (long long k = a[j]; k <= i; k++)
          dp[i][j] = (dp[i][j] + dp[i - k][j + 1] * c[i - 1][k]) % MOD;
      } else {
        for (long long k = a[j]; k <= i; k++)
          dp[i][j] = (dp[i][j] + dp[i - k][j + 1] * c[i][k]) % MOD;
      }
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = (ans + dp[i][0]) % MOD;
  cout << ans << "\n";
}
