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.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
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 AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    final static int MOD = (int)1e9 + 7;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = Utils.readIntArray(in, 10);
        int res = 0;
        for (int d = 1; d <= 9; ++d) {
            int prev = a[d];
            if (a[d] > 0) {
                --a[d];
            }
            for (int len = 0; len <= n-1; ++len) {
                res += process(a, len);
                if (res >= MOD) {
                    res -= MOD;
                }
            }

            a[d] = prev;
        }
        out.println(res);
    }

    static int[][] C = IntegerUtils.getC(200, MOD);

    private int process(int[] a, int n) {
        if (n == 0) {
            for (int i = 0; i < 10; ++i) {
                if (a[i] != 0) {
                    return 0;
                }
            }
            return 1;
        }
        int[][] f = new int[10][n+1];
        for (int am0 = a[0]; am0 <= n; ++am0) {
            f[0][am0] = C[n][am0];
        }
        for (int digit = 0; digit < 9; ++digit) {
            for (int covered = 0; covered <= n; ++covered) {
                if (f[digit][covered] > 0) {
                    if (n - covered >= a[digit + 1]) {
                        for (int add = n - covered; add >= a[digit + 1]; --add) {
                            f[digit + 1][covered + add] += (int) ((C[n - covered][add] * 1L * f[digit][covered]) % MOD);
                            if (f[digit + 1][covered + add] >= MOD) {
                                f[digit + 1][covered + add] -= MOD;
                            }
                        }
                    }
                }
            }
        }
        return f[9][n];
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

class Utils {
    public static int[] readIntArray(InputReader in, int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        return a;
    }

}

class IntegerUtils {

    public static int[][] getC(int N, int MOD) {
        int[][] C = new int[N][];
        for (int i = 0; i < N; ++i) {
            C[i] = new int[i + 1];
            for (int j = 0; j <= i; ++j) {
                if (j == 0 || j == i) {
                    C[i][j] = 1;
                    if (C[i][j] >= MOD) C[i][j] -= MOD;
                } else {
                    C[i][j] = (C[i-1][j-1] + C[i-1][j]);
                    if (C[i][j] >= MOD) C[i][j] -= MOD;
                }
            }
        }
        return C;
    }

}

