class Combi(): def __init__(self, N, mod): self.power = [1 for _ in range(N+1)] self.rev = [1 for _ in range(N+1)] self.mod = mod for i in range(2, N+1): self.power[i] = (self.power[i-1]*i) % self.mod self.rev[N] = pow(self.power[N], self.mod-2, self.mod) for j in range(N, 0, -1): self.rev[j-1] = (self.rev[j]*j) % self.mod def C(self, K, R): if K < R: return "NA" else: return ((self.power[K])*(self.rev[K-R])*(self.rev[R])) % self.mod def P(self, K, R): if K < R: return "NA" else: return (self.power[K])*(self.rev[K-R]) % self.mod mod =10**9 + 7 M = int(input()) H = list(map(int, input().split())) L = len(H) M += (L-sum(H)) M -= (L-1) if M >= 0: c = Combi(M, mod) print(c.C(M, L)) else: print("NA")