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

public class B implements Runnable {
    private MyScanner in;
    private PrintWriter out;

    final int MOD = 1000000007;

    int mod(int n) {
        if (n < 0) {
            return n + MOD;
        }
        if (n >= MOD) {
            return n - MOD;
        }
        return n;
    }

    private void solve() {
        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] = 1;
        }
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                c[i][j] = mod(c[i - 1][j] + c[i - 1][j - 1]);
            }
        }

        long ans = 0;
        for (int len = 1; len <= n; ++len) {
            long[][] dp = new long[11][len + 1];
            dp[0][0] = 1;
            for (int i = 0; i < 10; ++i) {
                for (int j = a[i]; j <= len; ++j) {
                    if (i == 0) {
                        for (int k = 0; k + j <= len - 1; ++k) {
                            dp[i + 1][k + j] += dp[i][k] * c[len - 1 - k][j];
                            dp[i + 1][k + j] %= MOD;                            
                        }
                    } else {
                        for (int k = 0; k + j <= len; ++k) {
                            dp[i + 1][k + j] += dp[i][k] * c[len - k][j];
                            dp[i + 1][k + j] %= MOD;                            
                        }
                    }
                }
            }
            ans += dp[10][len];
        }
        out.println(ans % MOD);
    }

    @Override
    public void run() {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    public static void main(String[] args) {
        new B().run();
    }

    class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(String fileName) {
            try {
                br = new BufferedReader(new FileReader(fileName));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public boolean hasNext() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String s = br.readLine();
                    if (s == null) {
                        return false;
                    }
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    return false;
                }
            }
            return true;
        }

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

        public String nextLine() {
            try {
                st = null;
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}