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 javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.util.*;

public class C{

    long[][]comb;
    final static long mod=1000000007 ;
    void solve()throws Exception
    {
        int n=nextInt();
        comb=new long[n+1][n+1];
        for(int i=0;i<=n;i++)
        {
            comb[i][0]=1;
            for(int j=1;j<=i;j++)
                comb[i][j]=(comb[i-1][j-1]+comb[i-1][j])%mod;
        }
        long res=0;
        int[]a=new int[10];
        for(int i=0;i<10;i++)
            a[i]=nextInt();
        for(int firstDig=1;firstDig<=9;firstDig++)
        {

            int[]need=a.clone();
            need[firstDig]--;
            if(need[firstDig]<0)
                need[firstDig]=0;
            long cur=count(n-1,need);
            res=(res+cur)%mod;
        }
        System.out.println(res);

    }

    private long count(int n, int[] need) {

        long res=0;
        for(int N=0;N<=n;N++)
        {
            long[][]dp=new long[11][N+1];
            for(int i=0;i<=10;i++)
                for(int j=0;j<=N;j++)
                    dp[i][j]=-1;
            res=(go(0,N,need,dp)+res)%mod;
        }

        return res;

    }

    private long go(int at, int rem, int[] need, long[][] dp) {
        if(dp[at][rem]!=-1)
            return dp[at][rem];
       if(at==10)
       {
           if(rem==0)
                return 1;
           else
               return 0;
       }
       long res=0;
        for(int cur=need[at];cur<=rem;cur++)
            res=(res+go(at+1,rem-cur,need,dp)*comb[rem][cur])%mod;
         return dp[at][rem]=res;




    }


    ////////////
    BufferedReader reader;
    PrintWriter writer;
    StringTokenizer stk;
    void run()throws Exception
    {
        reader=new BufferedReader(new InputStreamReader(System.in));
        stk=null;
        writer=new PrintWriter(System.out);
        solve();
        reader.close();
        writer.close();
    }
    int nextInt()throws Exception
    {
        return Integer.parseInt(nextToken());
    }

    long nextLong()throws Exception
    {
        return Long.parseLong(nextToken());

    }
    double nextDouble()throws Exception
    {
        return Double.parseDouble(nextToken());


    }

    String nextString()throws Exception
    {
        return nextToken();
    }
    String nextLine()throws Exception
    {
        return reader.readLine();
    }
    String nextToken()throws Exception
    {
        if(stk==null || !stk.hasMoreTokens())
        {
            stk=new StringTokenizer(nextLine());
            return nextToken();

        }
        return stk.nextToken();
    }

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


}