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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Abhas Jain
 */
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);
        BNumbers solver = new BNumbers();
        solver.solve(1, in, out);
        out.close();
    }

    static class BNumbers {
        public long mod = (long) 1e9 + 7L;
        long[] fact = new long[101];

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.ni();
            fact[0] = 1;
            for (int i = 1; i <= 100; ++i) {
                fact[i] = (fact[i - 1] * i) % mod;
            }
            int[] ar = new int[10];
            for (int i = 0; i < 10; ++i) ar[i] = in.ni();
            long[][] dp = new long[n + 1][10];
            for (int i = 0; i <= n; ++i) {
                if (i >= ar[9]) dp[i][9] = 1;
            }
            for (int len = 0; len <= n; ++len) {
                for (int j = 8; j >= 0; --j) {
                    for (int i = ar[j]; i <= len; ++i) {
                        if (j != 0)
                            dp[len][j] = (dp[len][j] % mod + (dp[len - i][j + 1] % mod) * (nck(len, i) % mod)) % mod;
                        else if (len - 1 >= i) {
                            dp[len][j] = (dp[len][j] % mod + (dp[len - i][j + 1] % mod) * (nck(len - 1, i) % mod)) % mod;
                        }
                    }
                }
            }
            long ans = 0;
            for (int i = 0; i <= n; ++i) {
                ans += dp[i][0];
                ans %= mod;
            }
            out.print(ans % mod);
        }

        public long nck(int n, int k) {
            long up = fact[n];
            long down = (maths.modInverse(fact[k], mod) % mod * maths.modInverse(fact[n - k], mod) % mod) % mod;
            return (up % mod * down % mod) % mod;
        }

    }

    static class maths {
        public static long modPow(long base, long pow, long mod) {
            long res = 1L;
            base = base % mod;
            while (pow > 0) {
                if ((pow & 1L) == 1L) res = (res * base) % mod;
                pow = pow >> 1L;
                base = (base * base) % mod;
            }
            return res;
        }

        public static long modInverse(long num, long mod) {
            return modPow(num, mod - 2, mod);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}

