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

public class Solution{
	
	static final int mod = (int)1e9+7;
	static final int N = 105;
	static int n;
	static int[] a;
	static int[] fact, invfact;
	
	
    public static void main(String[] args) throws IOException {
     
    	FastScanner fs = new FastScanner();
    	PrintWriter out = new PrintWriter(System.out);
    	
    	
    		
    	int tt = 1;
    	while(tt-->0) {
    		
    		n = fs.nextInt();
    		
    		int sum = 0;
    		a = new int[10];
    		
    		for(int i=0;i<10;i++) {
    			a[i] = fs.nextInt();
    			sum += a[i];
    		}
    		
    		fact = new int[N];
    		fact[0] = 1;
    		for(int i=1;i<N;i++) fact[i] = mul(fact[i-1], i);
    		
    		invfact = new int[N];
    		invfact[N-1] = inv(fact[N-1]);
    		
    		for(int i=N-2;i>=0;i--) invfact[i] = mul(invfact[i+1], i+1);
    		
    		
    		//dp[i][len] -- number of numbers formed by using i...9 digits and of length len
    		int[][] dp = new int[10][N];
    		
    		for(int i=a[9];i<=n;i++) dp[9][i] = 1;
    		
    		for(int i=8;i>0;i--) {
    			for(int len=0;len<=n;len++) {
    				for(int j=a[i];j<=n;j++) {
    					if(len>=j) {
    						dp[i][len] = add(dp[i][len], mul(nCr(len, j), dp[i+1][len-j]));
    					}
    				}
    			}
    		}
    		
    		for(int len=0;len<=n;len++) {
    			for(int j=a[0];j<=n;j++) {
    				if(len>=j) {
    					dp[0][len] = add(dp[0][len], mul(nCr(len-1, j), dp[1][len-j]));
    				}
    			}
    		}
    		
    		int ans = 0;
    		
    		for(int len=sum;len<=n;len++) ans = add(ans, dp[0][len]);
    		
    		out.println(ans);
    		
    		
    		
    		
    		
    		
    		
    	}
    	
    		
    		
    		
    	out.close();
    		
    }
    
    
    
    static int nCr(int x, int y) {
    	if(x<y) return 0;
    	int res = 1;
    	res = mul(res, fact[x]);
    	res = mul(res, invfact[y]);
    	res = mul(res, invfact[x-y]);
    	return res;
    }
    
    
    
    
    static int inv(int n) {
    	return bExp(n, mod - 2);
    }
    
    static int bExp(int a, long n) {
    	int res = 1;
    	while(n>0) {
    		if((n&1)==1) res = mul(res, a);
    		a = mul(a, a);
    		n = n>>1;
    	}
    	return res;
    }
    
    
    static int add(int a, int b) {
    	a += b;
    	if(a>=mod) return a-mod;
    	return a;
    }
    
    
    static int mul(int a,int b) {
    	return (int)(((long)a*b)%mod);
    }
   
    
    
    static final Random random=new Random();
    	
    static void ruffleSort(int[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); int temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
    
    static void ruffleSort(long[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); long temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
   
  
    
    static void reverse(int[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    static void reverse(long[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    
    static <T> void reverse(T[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++) {
    		T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    	
    	
    static class FastScanner{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
     
    	public String next(){
    		while(!st.hasMoreElements()){
    			try{
    				st = new StringTokenizer(br.readLine());
    			} catch(IOException e){
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}
    		
    	public String nextLine() throws IOException {
    		return br.readLine();
    	}
    		
    	public int nextInt(){
    		return Integer.parseInt(next());
    	}
     
    	public int[] readArray(int n){
    		int[] a = new int[n];
    		for(int i=0;i<n;i++)
    			a[i] = nextInt();
    		return a;
    	}
    		
    	public long nextLong() {
    		return Long.parseLong(next());
    	}
    		
    	public char nextChar() {
    		return next().toCharArray()[0];
    	}
    }
   	
}
