import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().run(); } void run() { FastScanner sc=new FastScanner(); PrintWriter pw=new PrintWriter(System.out); int N=sc.nextInt(); int[] S=new int[N+1]; long[][] dp=new long[N+1][]; long INF=Long.MAX_VALUE/3; for (int i=0;i<=N;++i) { S[i]=sc.nextInt(); dp[i]=new long[S[i]+1]; Arrays.fill(dp[i], INF); } dp[0][0]=1; for (int i=0;i<=N;++i) { for (int nk=1;nk<=S[i];++nk) { for (int a=0;a