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.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().run(in, out);
        out.close();
    }

    public static int mod = 1_000_000_007;

    long[][] dp;
    int[] a;
    void run(FastScanner in, PrintWriter out) {
        int N = in.nextInt();
        a = new int[10];
        int tot = 0;
        for (int i = 0; i < 10; i++) {
            a[i] = in.nextInt();
            tot += a[i];
        }

        if (tot > N) {
            out.println(0);
            return;
        }

        f = new long[102];
        f[0] = 1;
        for (int i = 1; i < 102; i++) {
            f[i] = (f[i-1] * i) % mod;
        }

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

        for (int i = 9; i >= 0 && a[i] == 0; i--) {
            dp[0][i] = 1;
        }

        long sum = 0;
        for (int len = 1; len <= N; len++) {



            // 9
            dp[len][9] = len >= a[9] ? 1 : 0;

            // 1-8
            for (int j = 8; j >= 1; j--) {

                for (int i = a[j]; i <= len; i++) {

                    dp[len][j] = (dp[len][j] + dp[len-i][j+1] * c[len][i]) % mod;
                }
            }

            // 0
            for (int i = a[0]; i <= len; i++) {
                dp[len][0] = (dp[len][0] + dp[len-i][1] * c[len-1][i]) % mod;
            }

            sum = (sum + dp[len][0]) % mod;
        }
        // for (long[] d : dp) System.out.println(Arrays.toString(d));

        out.println(sum);


    }

    long[] f;

    static long[][] c = new long[101][101];
    static {
        c[0][0] = 1;
        for (int i = 1; i < c.length; i++) {
            c[i][0] = 1;
            for (int j = 1; j <= i; j++) {
                c[i][j] = (c[i-1][j-1] + c[i-1][j]) % mod;
            }
        }
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
