Time Limit: 2 second(s) | Memory Limit: 32 MB |
You are given a rectangular board. You are asked to draw M horizontal lines and N vertical lines in that board, so that the whole board will be divided into (M+1) x (N+1) cells. So, there will be M+1 rows each of which will exactly contain N+1 cells or columns. The y^{th} cell of x^{th} row can be called as cell(x, y). The distance between two cells is the summation of row difference and column difference of those two cells. So, the distance between cell(x_{1}, y_{1}) and cell(x_{2}, y_{2}) is
|x_{1} - x_{2}| + |y_{1} - y_{2}|
For example, the distance between cell (2, 3) and cell (3, 2) is |2 - 3| + |3 - 2| = 1 + 1 = 2.
After that you have to color every cell of the board. For that you are given K different colors. To make the board more beautiful you have to make sure that no two cells having the same color can have odd distance between them. For example, if you color cell (3, 5) with red, you cannot color cell (5, 8) with red, as the distance between them is 5, which is odd. Note that you can keep some color unused, but you can't keep some cell uncolored.
You have to determine how many ways to color the board using those K colors.
Input starts with an integer T (≤ 20000), denoting the number of test cases.
Each case starts with a line containing three integers M, N, K (0 ≤ M, N ≤ 19, 1 ≤ K ≤ 50).
For each case, print the case number and the number of ways you can color the board. The result can be large, so print the result modulo 1000000007.
Sample Input |
Output for Sample Input |
4 0 0 1 0 0 2 5 5 2 5 5 1 |
Case 1: 1 Case 2: 2 Case 3: 2 Case 4: 0 |
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |