1812 涂颜色


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

有n个未涂色的球,编号1到n。现在要给它们涂色。已知有m种颜料,每种颜料剩余量不一,因此每种颜料能够涂的球的个数是不同的,令它们是c1,c2,。。。,cm。

问有多少种给所有球上颜色的方案。

Input

多组数据。每组数据第一行两个整数n,m(1<=n<=10, 1<=m<=n)。 然后是m个整数,表示每种颜色能够涂多少个球。每个整数在[0, n]之间,数据保证m个数的和等于n。

Output

首先输出case,然后是方案数。

Sample

Input

1 1
1

2 2
1 1

4 3
1 1 2

10 5
2 2 2 2 2

Output

Case 1: 1
Case 2: 2
Case 3: 12
Case 4: 113400

Source: zjut_DD


Comments

There are no comments at the moment.