n=int(input()) M=10**9+7 fa=[1,1] fb=[1,1] for i in range(2,n*2+1): fa+=[fa[-1]*i%M] fb+=[fb[-1]*(M//i)*fb[M%i]*fa[M%i-1]*(-1)%M] c=lambda n,k:fa[n]*fb[k]*fb[n-k]%M if n>=k>=0 else "NA" h=list(map(int,input().split())) if h==[0]: print(1) exit() k=len(h) print(c(n-sum(h)-(k-1)+k+1-1,k+1-1))