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;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &A) {
  for (long long i = 0; i < A.size(); i++) os << A[i] << " ";
  os << endl;
  return os;
}
template <>
ostream &operator<<(ostream &os, const vector<vector<long long> > &A) {
  long long N = A.size();
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < A[i].size(); j++) os << A[i][j] << " ";
    os << endl;
  }
  return os;
}
struct edge {
  long long from, to, d, c;
  edge(long long _from = 0, long long _to = 0, long long _d = 0,
       long long _c = 0) {
    from = _from;
    to = _to;
    d = _d;
    c = _c;
  }
  bool operator<(const edge &rhs) const {
    return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
  }
};
struct aabb {
  long long x1, y1, x2, y2;
  aabb(long long x1, long long y1, long long x2, long long y2)
      : x1(x1), y1(y1), x2(x2), y2(y2) {}
};
struct flow {
  long long to, cap, rev, cost;
  flow(long long to = 0, long long cap = 0, long long rev = 0,
       long long cost = 0)
      : to(to), cap(cap), rev(rev), cost(cost) {}
};
const long long di[4] = {0, -1, 0, 1};
const long long dj[4] = {-1, 0, 1, 0};
const long long ci[5] = {0, 0, -1, 0, 1};
const long long cj[5] = {0, -1, 0, 1, 0};
const long long LINF = LLONG_MAX / 2;
const long long INF = INT_MAX / 2;
const long double PI = acos(-1);
long long pow2(long long n) { return 1LL << n; }
template <typename T, typename U>
bool chmin(T &x, const U &y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T, typename U>
bool chmax(T &x, const U &y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
struct initializer {
  initializer() { cout << fixed << setprecision(20); }
};
initializer _____;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long extgcd(long long a, long long b, long long &x, long long &y) {
  long long d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}
long long factorial(long long x) {
  if (x == 1)
    return 1;
  else
    return x * factorial(x - 1);
}
long long Mfactorial(long long x, long long m) {
  long long ret = 1;
  for (long long i = 1; i <= x; i++) {
    ret *= i;
    ret %= m;
  }
  return ret;
}
vector<long long> MfactTable(long long n, long long m) {
  vector<long long> ret(n + 1);
  ret[0] = 1;
  long long tmp = 1;
  for (long long i = 1; i <= n; i++) {
    tmp *= i;
    tmp %= m;
    ret[i] = tmp;
  }
  return ret;
}
long long Minverse(long long a, long long m) {
  long long x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}
long long McombSmall(long long n, long long k, long long m) {
  if (k > n) return 0;
  long long ret = Mfactorial(n, m);
  ret *= Minverse(Mfactorial(k, m), m);
  ret %= m;
  ret *= Minverse(Mfactorial(n - k, m), m);
  return ret % m;
}
long long McombFromFactTable(vector<long long> &T, long long n, long long k,
                             long long m) {
  if (k > n) return 0;
  long long ret = T[n];
  ret *= Minverse(T[k], m);
  ret %= m;
  ret *= Minverse(T[n - k], m);
  return ret % m;
}
long long pow(long long x, long long n) {
  if (n == 0) return 1;
  long long ret = (n & 1) ? x : 1;
  long long a = pow(x, n / 2);
  return ret * a * a;
}
long long Mpow(long long x, long long n, long long m) {
  if (n == 0) return 1;
  long long ret = (n & 1) ? x : 1;
  long long a = Mpow(x, n / 2, m);
  return (((ret * a) % m) * a) % m;
}
vector<vector<long long> > combTable(long long N) {
  vector<vector<long long> > ret(N + 1, vector<long long>(N + 1));
  for (long long i = 0; i <= N; i++)
    for (long long j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        ret[i][j] = 1;
      else
        ret[i][j] = ret[i - 1][j - 1] + ret[i - 1][j];
    }
  return ret;
}
long long countNmodPisQlr(long long l, long long r, long long P, long long Q) {
  return (r - Q + P) / P - (l - Q + P - 1) / P;
}
struct Combination {
  long long N = 0, M;
  vector<long long> Ftable, FItable, Inversetable;
  void init() {
    Ftable.resize(N + 1);
    FItable.resize(N + 1);
    Inversetable.resize(N + 1);
    Ftable[0] = 1;
    FItable[0] = 1;
    for (long long i = 1; i <= N; i++) Ftable[i] = Ftable[i - 1] * i % M;
    FItable[N] = Minverse(Ftable[N], M);
    for (long long i = N - 1; i >= 1; i--)
      FItable[i] = FItable[i + 1] * (i + 1) % M;
    Inversetable[1] = 1;
    for (long long i = 2; i <= N; i++)
      Inversetable[i] = M - Inversetable[M % i] * (M / i) % M;
  }
  Combination(long long max, long long mod) {
    N = max;
    M = mod;
    init();
  }
  long long calc(long long n, long long k) {
    if (k > n) return 0;
    long long ret = Ftable[n] * FItable[k] % M * FItable[n - k] % M;
    return ret;
  }
  long long inverse(long long n) { return Inversetable[n]; }
  long long factorial(long long n) { return Ftable[n]; }
  long long factorialInverse(long long n) { return FItable[n]; }
  long long permutation(long long n, long long k) {
    if (k > n) return 0;
    return Ftable[n] * FItable[n - k] % M;
  }
};
long long N, M, K, T, Q, H, W;
signed main() {
  cin >> N;
  vector<long long> A(10);
  for (long long i = 0; i < (long long)(10); i++) cin >> A[i];
  vector<vector<long long> > dp(N + 1, vector<long long>(10, 0));
  long long ans = 0;
  Combination cmb(N + 10, 1000000007);
  for (long long i = 0; i < (long long)(N + 1); i++)
    for (long long j = 9; j >= 0; j--) {
      if (j == 9) {
        if (i >= A[9]) dp[i][j] = 1;
      } else if (j == 0) {
        for (long long k = A[j]; k <= i - 1; k++) {
          dp[i][j] += dp[i - k][1] * cmb.calc(i - 1, k) % 1000000007;
          dp[i][j] %= 1000000007;
        }
        (ans += dp[i][j]) %= 1000000007;
      } else {
        for (long long k = A[j]; k <= i; k++) {
          dp[i][j] += dp[i - k][j + 1] * cmb.calc(i, k) % 1000000007;
          dp[i][j] %= 1000000007;
        }
      }
    }
  cout << ans << endl;
  return 0;
}
