// Arup Guha
// 5/28/2016
// Solution to 2014 NCNA Problem F: Restaurant Ratings

import java.util.*;

public class restaurant {

    final public static int MAX = 46;

    public static void main(String[] args) {

        // Build Pascal's Triangle for easy lookup of combos.
        long[][] tri = new long[MAX][MAX];
        for (int i=0; i<MAX; i++) {
            tri[i][0] = 1;
            tri[i][i] = 1;
        }
        for (int i=2; i<MAX; i++)
            for (int j=1; j<i; j++)
                tri[i][j] = tri[i-1][j-1] + tri[i-1][j];

        Scanner stdin = new Scanner(System.in);
        int loop = 1;
        int n = stdin.nextInt();

        // Process all input.
        while (n != 0) {

            // Store values and calculate sum.
            int[] vals = new int[n];
            int sum = 0;
            for (int i=0; i<n; i++) {
                vals[i] = stdin.nextInt();
                sum += vals[i];
            }

            // How many ways can I sum n non-neg ints less than or equal to sum?
            // C(sum+n, n) - now just sub out ones that sum to the same but are lexicographically larger.
            long res = tri[sum+n][n];

            // Now, we must sub out all the ones that sum to sum and beat this one.
            int tempsum = 1;
            for (int i=0; i<n-1; i++) {
                tempsum += vals[i];
                // n-1-i vals sum to sum-tempsum
                res = res - tri[sum-tempsum+n-i-1][n-i-1];
            }

            // Output result and go to the next case.
            System.out.println("Case "+loop+": "+res);
            n = stdin.nextInt();
            loop++;
        }
    }
}
