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

public class Round131B {

	public static long mod = (long)1e9+7;
	public static long[] fact;
	public static long[] invfact;
	public static long nCr(int n, int r) {
		return ((((fact[n] * invfact[n - r])%mod) * invfact[r])%mod);
	}
	
	public static long[][] dp;
	public static int[] a;
	
	public static void solve() {
		fact = new long[110];
		invfact = new long[110];
		fact[0] = 1;
		invfact[0] = 1;
		for(int i = 1; i < 110; i++) {
			fact[i] = (fact[i - 1] * i)%mod;
			invfact[i] = (invfact[i - 1] * ModInverse(i, mod))%mod;
		}
		int n = s.nextInt();
		a = new int[10];
		for(int i = 0; i < 10; i++) {
			a[i] = s.nextInt();	
		}
		long ans = 0;
		for(int i = n; i >= 1; i--) {
			dp = new long[10][n + 1];
			for(int j = 0; j < 10; j++) {
				for(int k = 0; k <= n; k++) {
					dp[j][k] = -1;
				}
			}
			ans += Recur(0, i);
			if(ans >= mod) ans -= mod;
		}
		out.println(ans);
	}
	
	public static long Recur(int curr_number, int size) {
		if(size == 0) {
			if(curr_number == 10) {
				return 1;
			}else {
				boolean ok = true;
				for(int j = curr_number; j <= 9; j++) {
					if(a[j] != 0) ok = false;
				}
				if(ok) return 1;
				else return 0;
			}
		}
		if(curr_number == 10) {
			return 0;
		}
		if(a[curr_number] > size) {
			return 0;
		}
		if(dp[curr_number][size] != -1) {
			return dp[curr_number][size];
		}
		long ans = 0;
		int lmtE = size;
		if(curr_number == 0) lmtE--;
		for(int i = a[curr_number]; i <= lmtE; i++) {
			ans += (Recur(curr_number + 1, size - i) * nCr(lmtE, i))%mod;
			if(ans >= mod) ans -= mod;
		}
		return dp[curr_number][size] = ans;
	}

	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		s = new FastReader();
		solve();
		out.close();
	}
	
	public static class Triplet {
		long gcd;
		long x;
		long y;

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

	public static Triplet ExtendedEuclideanAlgo(long a, long b) {
		if (a == 0) {
			return new Triplet(b, 0, 1);
		}
		Triplet ans = ExtendedEuclideanAlgo(b % a, a);
		long x = ans.y - (b / a) * ans.x;
		long y = ans.x;
		return new Triplet(ans.gcd, x, y);
	}

	public static long ModInverse(long a, long m) {
		Triplet ans = ExtendedEuclideanAlgo(a, m);
		if (ans.gcd != 1) {
			//System.out.println("Multiplicative inverse doesnot exist");
			return -1;
		} else {
			//m is added to handle negative x
			long result = (ans.x % m + m) % m;
			return result;
		}
	}

	public static FastReader s;
	public static PrintWriter out;

	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	
}
