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 P213B
{
    public static StringTokenizer st;
    public static void nextLine(BufferedReader br) throws IOException
    {
        st = new StringTokenizer(br.readLine());
    }
    
    public static String next()
    {
        return st.nextToken();
    }
    
    public static int nextInt()
    {
        return Integer.parseInt(st.nextToken());
    }
    
    public static long nextLong()
    {
        return Long.parseLong(st.nextToken());
    }
    
    static long MOD = 1000000007;
    static long[][] dp;
    static int[] a, sum;
    static long[] fact, MODI;
    
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        nextLine(br);
        int n = nextInt();
        nextLine(br);
        a = new int[10];
        sum = new int[10];
        fact = new long[101];
        fact[0] = 1;
        fact[1] = 1;
        for (int i = 2; i < 101; i++)
        {
            fact[i] = modm(fact[i-1], i);
        }
        MODI = new long[101];
        for (int i = 1; i < 101; i++)
        {
            MODI[i] = modinv(i);
        }
        for (int i = 0; i < 10; i++) a[i] = nextInt();
        sum[9] = a[9];
        for (int i = 8; i >= 0; i--)
        {
            sum[i] = sum[i+1] + a[i];
        }
        dp = new long[n+1][10];
        for (int i = 0; i < n+1; i++)
        {
            Arrays.fill(dp[i], -1);
        }
        if (sum[0] > n)
        {
            System.out.println(0);
            return;
        }
        long val = 0;
        for (int i = Math.max(1, sum[0]); i <= n; i++)
        {
            val = moda(val, solve(i, 0));
        }
        System.out.println(val);
    }
    
    public static long solve(int n, int cap)
    {
        if (cap == 9)
        {
            if (n < a[9] || n < 0) return 0;
            else return 1;
        }
        if (n < sum[cap]) return 0;
        if (n < 0) return 0;
        if (n == 0) return 1;
        if (dp[n][cap] != -1) return dp[n][cap];
        if (n == sum[cap])
        {
            if (cap > 0 || (cap == 0 && a[0] == 0))
            {
                long ans = fact[n];
                for (int i = cap; i <= 9; i++)
                {
                    if (a[i] != 0)
                    {
                        ans = modm(ans, modinv(fact[a[i]]));
                    }
                }
                dp[n][cap] = ans;
                //System.out.printf("Bnswer to n=%d and cap=%d is %d\n", n, cap, ans);
                return ans;
            }
            else
            {
                long ans = fact[n];
                for (int i = cap; i <= 9; i++)
                {
                    ans = modm(ans, modinv(fact[a[i]]));
                }
                long ans2 = fact[n-1];
                for (int i = 1; i <= 9; i++)
                {
                    ans2 = modm(ans2, modinv(fact[a[i]]));
                }
                ans2 = modm(ans2, modinv(fact[a[0] - 1]));
                ans = ans - ans2;
                if (ans < 0) 
                {
                    ans += MOD;
                }
                dp[n][cap] = ans;
                //System.out.printf("Cnswer to n=%d and cap=%d is %d, %d\n", n, cap, ans, ans2);
                return ans;
            }
        }
        long ans = 0;
        for (int i = a[cap]; i <= n; i++)
        {
            long num = modm(choose(n, i), solve(n-i, cap+1));
            ans = moda(ans, num);
        }
        if (cap == 0)
        {
            long ans2 = 0;
            for (int i = Math.max(0, a[0]-1); i <= n-1; i++)
            {
                long num = modm(choose(n-1, i), solve(n-i-1, cap+1));
                ans2 = moda(ans2, num);
            }
            ans -= ans2;
            if (ans < 0) ans += MOD;
        }
        dp[n][cap] = ans;
        //System.out.printf("Answer to n=%d and cap=%d is %d\n", n, cap, ans);
        return ans;
    }
    
    static long choose(long n, long k)
    {
        long sum = 1;
        for (int i = 1; i <= k; i++)
        {
            sum = modm(sum, n-i+1);
            sum = modm(sum, MODI[i]);
        }
        return sum;
    }
    
    static long modexp(long a, long b)
    {
        long k = 1;
        while (b > 0)
        {
            if ((b & 1) == 1)
            {
                k = modm(a, k);
            }
            b = b >> 1;
            a = modm(a, a);
        }
        return k;
    }
    
    static long modinv(long a)
    {
        return modexp(a, MOD-2);
    }
    
    static long modm(long a, long b)
    {
        return (a * b) % MOD;
    }
    
    static long moda(long a, long b)
    {
        return (a+b) % MOD;
    }
}
