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.InputStreamReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

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

class TaskB {
    final int mod = 1000000000 + 7;
	public void solve(int testNumber, FastInputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] dig = new int[10];
        InputUtils.inputArray(in, dig);
        int[][]cnk = new int[110][110];
        for (int i = 0; i < 110; ++i) {
            cnk[i][0] = cnk[i][i] = 1;
            for (int j = 1; j < i; ++j)
                cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % mod;
        }
        int ans = 0;
        for (int up = 0; up <= n; ++up) {
            int[][] dyn = new int[up + 1][11];
            dyn[0][0] = 1;
            for (int len = 0; len <= up; ++len) {
                for (int last = 0; last < 10; ++last) {
                    if (dyn[len][last] == 0)
                        continue;
                    for (int take = dig[last]; take <= (last == 0 ? up - len - 1 : up - len); ++take) {
                        int choice = (last == 0 ? cnk[up - len - 1][take] :
                            cnk[up - len][take]);
                        if (len + take <= up) {
                            dyn[len + take][last + 1] = (int) ((dyn[len + take][last + 1] +
                                                    (long)dyn[len][last] * choice % mod) % mod);
                        }
                    }
                }
            }
            ans = (ans + dyn[up][10]) % mod;
        }
        out.print(ans);
	}
}

class FastInputReader {
    private StringTokenizer tokenizer;
    public BufferedReader reader;
    public FastInputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer=null;
    }
    public String next() {
        try {
            while (tokenizer==null || !tokenizer.hasMoreTokens()){
                tokenizer=new StringTokenizer(reader.readLine());
            }
        } catch (IOException e) {
            return "-1";
        }
        return tokenizer.nextToken();
    }
    public int nextInt(){
        return Integer.parseInt(next());
    }
    }

class InputUtils {
    public static void inputArray(FastInputReader in, int[]...arrays){
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int j = 0; j < arrays.length; ++j) {
                arrays[j][i] = in.nextInt();
            }
        }
    }

}

