The easiest problem ever

Time Limit: 1000 ms

Memory Limit: 65535 ms

Description

bobo heared from fishhead that you have just learned dfs(the Depth-First-Search algorithm),so he want you to help him solve a very easy problem.
Just count how many consecutive 0 areas are there in a map consists of hexadecimal numbers.Of course you must change the map consists of hexadecimal numbers into the map consists of binary numbers.

Input

The input contains a lot of test cases,and is terminated by end of file. For each test case, you will get a pair of R(1<=R<=50)and C(1<=C<=50) represents how many rows and columns are there. Than there R rows every row contains C hexadecima numbers.

Output

Just print the case number and the number of areas of consecutive number 0 appers after the transformation.

Sample Input

5 5
fffff
ff00f
fffff
f0f0f
fffff

10 10
ffffffffff
1010110101
101010101f
10100101ff
ffffffffff
f0000000ff
1010110101
101010101f
10100101ff
ffffffffff

Sample Output

Case 1: 3
Case 2: 5

Hint

Source

bobo0906

提交代码