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.
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

import sun.reflect.generics.tree.ArrayTypeSignature;

/**
 * @author Roman Elizarov
 */
public class Round_131_B {
	private static final int MOD = 1000000007;

	public static void main(String[] args) {
		new Round_131_B().go();
	}

	int n;
	int[] a = new int[10];

	void go() {
		// read input
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		for (int i = 0; i < 10; i++)
			a[i] = in.nextInt();

		// solve
		int result = solve();

		// write result
		PrintStream out = System.out;
		out.println(result);
	}

	int[][] c = new int[101][101];
	int[][] dp = new int[11][101];

	int solve() {
		c[0][0] = 1;
		for (int i = 1; i <= 100; i++) {
			c[i][0] = 1;
			for (int j = 1; j <= 100; j++)
				c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
		}

		int sum = 0;
		for (int i = 0; i < 10; i++)
			sum += a[i];
		int res = 0;
		for (int len = Math.max(1, sum); len <= n; len++) {
			for (int fst = 1; fst < 10; fst++) {
				int slots = len - 1;
				int minSum = sum;
				if (a[fst] > 0)
					minSum--;
				for (int i = 0; i < 10; i++)
					Arrays.fill(dp[i], -1);
				Arrays.fill(dp[10], 0);
				dp[10][0] = 1;
				int combos = compute(fst, minSum, 0, slots);
				res = (res + combos) % MOD;
			}
		}
		return res;
	}

	private int compute(int fst, int minSum, int i, int slots) {
		if (minSum > slots)
			return 0;
		if (dp[i][slots] >= 0)
			return dp[i][slots];
		int min = a[i];
		if (min > 0 && i == fst)
			min--;
		int nextMinSum = minSum - min;
		int res = 0;
		for (int k = min; k <= slots; k++)
			res = (res + mul(compute(fst, nextMinSum, i + 1, slots - k), c[slots][k])) % MOD;
		return dp[i][slots] = res;
	}

	private int mul(long a, long b) {
		return (int)((a * b) % MOD);
	}
}
