import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

/**
 * Class that uses divide-and-conquer with caching to solve ACM-NC 2004, Problem 1
 *   @author Dave Reed
 *   @version 10/25/24
 */
public class ChangeMaker2 {
    private ArrayList<Integer> coins;
    private HashMap<String, Integer> cache;
    
    public ChangeMaker2(ArrayList<Integer> coins) {
        this.coins = coins;
        this.cache = new HashMap<String, Integer>();   
    }
    
    public int getChange(int amount) {
        return this.getChange(amount, coins.size()-1);
    }
    
    private int getChange(int amount, int maxCoinIndex) {
        if (maxCoinIndex < 0 || amount < 0) {
            return 0;
        }
        else if (!this.cache.containsKey(amount+","+maxCoinIndex)) {
            if (amount == 0) {			
                this.cache.put(amount+","+maxCoinIndex, 1);
            }
            else {					
                this.cache.put(amount+","+maxCoinIndex, 
                       this.getChange(amount-this.coins.get(maxCoinIndex), maxCoinIndex) +
                       this.getChange(amount, maxCoinIndex-1));
            }
        }
        return this.cache.get(amount+","+maxCoinIndex);
    }
    
    ////////////////////////////////////////////////////////////////////////////////////
    
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
	    int caseNum = 1;
        int numCoins = input.nextInt();
        
	    while (numCoins != -1) {
	        ArrayList<Integer> coins = new ArrayList<Integer>();
	        for (int i = 0; i < numCoins; i++) {
                coins.add(input.nextInt());			
	        }
	        Collections.sort(coins);

            ChangeMaker2 cm = new ChangeMaker2(coins);

	        if (caseNum > 1) {
                System.out.println();
            }
	        System.out.println("Case " + caseNum + ": " + cm.getChange(100) +
                             " combinations of coins");
            
            caseNum++;
            numCoins = input.nextInt();
        }
	    input.close();
    }
}
