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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
public class karastuba 
{
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is) 
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }
    
    
    }
    static long p;
    static long[] brute_mul(long a[],long b[])
    {
        if(a.length==0)
            return a;
        if(b.length==0)
            return b;
        long c[]=new long[a.length+b.length-1];
        for(int i=0;i<a.length;i++)
            for(int j=0;j<b.length;j++)
            {
                c[i+j]=(c[i+j]+a[i]*b[j])%p;
            }
        return c;
    }
    //a[0] represents x^0 a[1] x^1...
    static long[] karatsuba(long a[],long b[])
    {
        if(Math.max(a.length, b.length)<=100)
            return brute_mul(a,b);
        int half=Math.max(a.length, b.length);
        half++;
        half/=2;
        long a2[]=new long[Math.max(0,a.length-half)];
        long b2[]=new long[Math.max(0, b.length-half)];
        for(int i=half;i<a.length;i++)
            a2[i-half]=a[i];
        for(int i=half;i<b.length;i++)
            b2[i-half]=b[i];
        long c[]=new long[Math.min(half, a.length)];
        System.arraycopy(a, 0, c, 0, c.length);
        a=c.clone();
        c=new long[Math.min(half, b.length)];
        System.arraycopy(b, 0, c, 0, c.length);
        b=c.clone();
        long z0[]=karatsuba(a,b);
        for(int i=0;i<a2.length;i++)
            a[i]+=a2[i];
        for(int i=0;i<b2.length;i++)
            b[i]+=b2[i];
        long z1[]=karatsuba(a,b);
        long z2[]=karatsuba(a2,b2);
        long r[]=new long[Math.max(z2.length+2*half, z1.length+half)];
        for(int i=0;i<z2.length;i++)
        {
            r[i+half]-=z2[i];
            r[i+2*half]+=z2[i];
        }
        for(int i=0;i<z1.length;i++)
            r[i+half]+=z1[i];
        for(int i=0;i<z0.length;i++)
        {
            r[i]+=z0[i];
            r[i+half]-=z0[i];
        }
        for(int i=0;i<r.length;i++)
        {
            r[i]%=p;
            if(r[i]<0)
                r[i]+=p;
        }
        return r;
    }
    static long[] solve(ArrayList<long[]> f)
    {
        if(f.size()==1)
        {
            return f.get(0);
        }
        if(f.size()==2)
            return karatsuba(f.get(0),f.get(1));
        ArrayList<long[]> a=new ArrayList<>();
        ArrayList<long[]> b=new ArrayList<>();
        int half=f.size()/2;
        for(int i=0;i<f.size();i++)
        {
            if(i<half)
                a.add(f.get(i));
            else
                b.add(f.get(i));
        }
        return karatsuba(solve(a),solve(b));
    }
    static long[] reduce(long a[],int m)
    {
        if(a.length<=m)
            return a;
        long ans[]=new long[m];
        int n=a.length;
        System.arraycopy(a, 0, ans, 0, m);
        return ans;
        
    }
    static long mod_exp(long base,long exp,long mod)
    {
        long ans=1;
        while(exp>0)
        {
            if(exp%2==1)
            {
                ans*=base;
                ans%=mod;
            }
            exp/=2;
            base*=base;
            base%=mod;
        }
        return ans;
    }
    static long mod_inv(long x,long mod)
    {
        return mod_exp(x,mod-2,mod);
    }
    static long fact[],ifact[];
    static long ncr(int n,int r,long mod)
    {
        long ans=fact[n];
        ans*=((ifact[r]*ifact[n-r])%mod);
        return ans%mod;
    }
    public static void main(String args[]) throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        p=1000000007;
        int n=in.nextInt();
        int a[]=in.nextIntArray(10);
        fact=new long[501];
        fact[0]=fact[1]=1;
        ifact=new long[501];
        for(int i=2;i<=500;i++)
            fact[i]=(i*fact[i-1])%p;
        ifact[500]=mod_inv(fact[500],p);
        for(int i=499;i>=0;i--)
            ifact[i]=((i+1)*ifact[i+1])%p;
        long ans[]={1l};
        for(int i=1;i<10;i++)
        {
            long arr[]=new long[n+1];
            for(int j=a[i];j<=n;j++)
                arr[j]=ifact[j];
            ans=karatsuba(ans,arr);
            ans=reduce(ans,n+1);
        }
        long v=0;
        for(int i=1;i<=n;i++)
        {
            long x=fact[i]*ans[i];
            x%=p;
            long s=0;
            for(int j=a[0];j<=n-i;j++)
            {
                s=(s+ncr(j+i-1,j,p))%p;
            }
            x*=s;
            x%=p;
            v+=x;
            v%=p;
        }
        
        out.println(v);
        out.close();
    }

}
