spoj#BCAKE. Birthday Cake
Birthday Cake
Today is the birthday of Seraph. Kasumi as his best friend want to give a surprice to Seraph, she know that Seraph love to eat chocolate cake, unfortunately Seraph should not be too much to eat chocochip, the maximum he can only take K chocochip in the cake and he want the cake that he'll eat is rectangle. If Seraph can't get K chocochip or not rectangle then he don't want eat that cake.
You'll give the configuration of the cake, then please help Kasumi to know minimum area of that cake that Seraph can eat.
Input
first line is test case, then each test case will contain H (1 ≤ H ≤ 30), W (1 ≤ W ≤ 30), K (0 ≤ K ≤ 900) that means H is the height of cake, W is width of cake and K is maximum chocochip that seraph can eat.
on the next line you'll give the configuration of the cake where 'C' means chocochip area and '.' is normal cake area. You can assume that width and height of cake between 1 and 30 inclusive.
Output
Print one line A that means the minimum area that seraph can eat. If Seraph can't eat that cake then print '-1'
Example
Sample Input 1: 1
5 6 4 ...... .C.... ..CC.. ...CC. ......</p>Sample Output 1:
6
Sample Input 2: 1
5 6 3 ...... ...... ..CC.. ..CC.. ......</p>Sample Output 2: -1