import java.io.*; import java.util.*; public class Main_yukicoder389 { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Printer pr = new Printer(System.out); try { int m = Integer.parseInt(br.readLine()); List h = new ArrayList<>(); int sum = 0; for (String s : br.readLine().split(" ")) { int tmp = Integer.parseInt(s); h.add(tmp); sum += tmp; } preCombi2(1_000_000); int k = h.size(); if (sum == 0) { k = 0; } pr.println(C(m - sum - (k - 1) + k, k)); } catch (NumberFormatException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } pr.close(); } private static int MOD = 1_000_000_007; private static long[] fact; private static long[] ifact; private static void preCombi2(int size) { // cache size need size * 2 * 16. fact = new long[size + 1]; fact[0] = 1; for (int i = 1; i <= size; i++) { fact[i] = fact[i - 1] * i % MOD; } ifact = new long[size + 1]; ifact[0] = 1; int loop = MOD - 2; long x = fact[size]; ifact[size] = 1; while (loop > 0) { if (loop % 2 == 1) { ifact[size] = ifact[size] * x % MOD; } x = x * x % MOD; loop /= 2; } for (int i = size - 1; i >= 0; i--) { ifact[i] = ifact[i + 1] * (i + 1) % MOD; } } private static int C(int n, int r) { if (r > n) { return 0; } return (int)(((fact[n] * ifact[n - r]) % MOD) * ifact[r] % MOD); } @SuppressWarnings("unused") private static int P(int n, int r) { if (r > n) { return 0; } return (int)((fact[n] * ifact[n -r]) % MOD); } @SuppressWarnings("unused") private static int H(int n, int r) { if (n == 0 && r == 0) { return 1; } return C(n + r - 1, r); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }