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.
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;
/**
 *
 * @author calcsaransh
 */
public class Main {

    static int arr[];
    static int first;
    static final long MOD=1000000007;
    static long fact[];
    static long factinv[];
    static int n;
    static long ret;
    static long memo[][];
    public static void main(String[] args) {
        // TODO code application logic here
        try
        {
            fact=new long[105];
            factinv=new long[105];
            fact[0]=1;
            factinv[0]=1;
            for(int i=1;i<105;i++)
            {
                fact[i]=fact[i-1]*i;
                fact[i]%=MOD;
                factinv[i]=pow(fact[i],MOD-2);
                //System.out.println(i+" "+factinv[i]);
            }
            Parserdoubt pd=new Parserdoubt(System.in);
            PrintWriter pw=new PrintWriter(System.out);
            int nn=pd.nextInt();
            long res=0;
            
            arr=new int[10];
            for(int i=0;i<10;i++)arr[i]=pd.nextInt();
            for(n=1;n<=nn;n++)
            {
                
            ret=fact[n-1];
            
            for(first=1;first<=9;first++)
            {memo=new long[10][n];
                res+=find(0,n-1);
                //System.out.println(first+" "+res);
            }
            }
            System.out.println(res%MOD);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    public static long pow(long num,long pow)
    {
        if(pow==0)return 1;
        if(pow==1)return num;
        long tmp=pow/2;
        long ans=pow(num,tmp);
        ans*=ans;
        ans%=MOD;
        if(pow%2==1)ans*=num;
        ans%=MOD;
        return ans;
        
    }
    public static long find(int pos,int n)
    {
        //System.out.println(pos+" "+n);
        if(pos==10)
        {
            if(n==0)
            return ret;
            return 0;
        }
        if(memo[pos][n]>0)return memo[pos][n]-1;
        int start=arr[pos];
        if(pos==first)start--;
        long ways=0;
        for(int i=Math.max(start,0);i<=n;i++)
        {
            ways+=factinv[i]*find(pos+1,n-i);
            ways%=MOD;
        }
        memo[pos][n]=1+ways;
        return ways;
    }
}

class Parserdoubt {

    final private int BUFFER_SIZE = 1 << 17;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Parserdoubt(InputStream in) {
        din = new DataInputStream(in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String nextString() throws Exception {
        StringBuffer sb = new StringBuffer("");
        byte c = read();
        while (c <= ' ') {
            c = read();
        }
        do {
            sb.append((char) c);
            c = read();
        } while (c > ' ');
        return sb.toString();
    }

    public char nextChar() throws Exception {
        byte c = read();
        while (c <= ' ') {
            c = read();
        }
        return (char) c;
    }

    public int nextInt() throws Exception {
        int ret = 0;
        byte c = read();
        while (c <= ' ') {
            c = read();
        }
        boolean neg = c == '-';
        if (neg) {
            c = read();
        }
        do {
            ret = ret * 10 + c - '0';
            c = read();
        } while (c > ' ');
        if (neg) {
            return -ret;
        }
        return ret;
    }

    public long nextLong() throws Exception {
        long ret = 0;
        byte c = read();
        while (c <= ' ') {
            c = read();
        }
        boolean neg = c == '-';
        if (neg) {
            c = read();
        }
        do {
            ret = ret * 10 + c - '0';
            c = read();
        } while (c > ' ');
        if (neg) {
            return -ret;
        }
        return ret;
    }

    private void fillBuffer() throws Exception {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1) {
            buffer[0] = -1;
        }
    }

    private byte read() throws Exception {
        if (bufferPointer == bytesRead) {
            fillBuffer();
        }
        return buffer[bufferPointer++];
    }
}
