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.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {

    private static final int MOD = 1000000007;

    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int N = in.nextInt();
        int[] A = new int[10];
        for(int i = 0; i < 10; i++)
            A[i] = in.nextInt();

        int[][] C = new int[N + 1][N + 1];
        for(int i = 0; i <= N; i++) {
            C[i][0] = C[i][i] = 1;
            for(int j = 1; j < i; j++) {
                C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
                if(C[i][j] >= MOD)
                    C[i][j] -= MOD;
            }
        }

        int[][] dp = new int[N + 1][10];

        if(A[9] == 0)
            dp[0][9] = 1;
        else
            dp[0][9] = 0;
        for(int j = 8; j >= 0; j--)
            if(A[j] == 0)
                dp[0][j] = dp[0][j + 1];

        for(int i = 1; i <= N; i++) {
            if(i >= A[9])
                dp[i][9] = 1;
            else
                dp[i][9] = 0;

            for(int j = 8; j > 0; j--)
                for(int k = A[j]; k <= i; k++)
                    dp[i][j] = (int)((dp[i][j] + (long)dp[i - k][j + 1] * C[i][k]) % MOD);

            for(int k = A[0]; k < i; k++)
                dp[i][0] = (int)((dp[i][0] + (long)dp[i - k][1] * C[i - 1][k]) % MOD);
        }

        int res = 0;
        for(int i = 1; i <= N; i++)
            res = (res + dp[i][0]) % MOD;

        out.print(res);
	}
}

