MOD = 10**9 + 7 m = input() H = map(int, raw_input().split()) if H[0] == 0: print 1 else: cnt = m - (sum(H) + len(H)-1) + len(H) ans = 1 fact = [1]*(m+1) rev = [1]*(m+1) for i in xrange(1, m+1): fact[i] = (fact[i-1]*i) % MOD print (fact[cnt]*pow(fact[len(H)], MOD-2, MOD)*pow(fact[cnt-len(H)], MOD-2, MOD)) % MOD