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.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D {

	static int N;
	static int[] a;
	static int[] fac, facI;
	static final int MOD = (int) 1e9 + 7;
	static int[][][] memo;

	static int solve(int f, int i, int l) {
		if(i == 10)
			if(l == 0)
				return 1;
			else
				return 0;

		if(f != i && a[i] > l || f == i && a[i] - 1 > l)
			return 0;
		if(memo[f][i][l] != -1)
			return memo[f][i][l];
		long ans = 0;
		for (int j = Math.max(0, (i == f ? a[i] - 1 : a[i])); j <= l; j++) {
			ans += 1l * ncr(l, j) * solve(f, i + 1, l - j);
			ans %= MOD;
		}
		
		return memo[f][i][l] = (int) ans;
	}
	static int pow(int x, int p) {
		if(p == 0)
			return 1;
		long res = 1;
		if(p % 2 == 1)
			res = x;

		long c = pow(x, p / 2);
		res *= c;
		res %= MOD;
		res *= c;

		return (int) (res % MOD);
	}

	static int ncr(int n, int r) {
		return (int) (1l * fac[n] * facI[r] % MOD * facI[n - r] % MOD);
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		N = sc.nextInt();
		a = new int[10];
		for (int i = 0; i < 10; i++)
			a[i] = sc.nextInt();

		fac = new int[N + 1];
		facI = new int[N + 1];

		fac[0] = 1;
		facI[0] = pow(1, MOD - 2);

		for (int i = 1; i <= N; i++) {
			fac[i] = (int) (1l * i * fac[i - 1] % MOD);
			facI[i] = pow(fac[i], MOD - 2);
		}

		memo = new int[10][10][N + 1];
		
		for (int i = 0; i < 10; i++) 
			for (int j = 0; j < 10; j++) 
				Arrays.fill(memo[i][j], -1);
			
		long ans = 0;
		for (int i = 1; i <= N; i++) 
			for (int j = 1; j < 10; j++) {
				ans += solve(j, 0, i - 1);
				ans %= MOD;
			}
		
		out.println(ans);
			
		out.flush(); 
		out.close();
	}



	static class Pair {
		long x, y;

		Pair(long x, long y) {
			this.x = x;
			this.y = y;
		}
	}

	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String file) throws FileNotFoundException{	br = new BufferedReader(new FileReader(file));}
		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}


	}
}
