In the game of chess, there is a piece called the knight. A knight is special -- instead of moving in a straight line like other pieces, it jumps in an "L" shape. Specifically, a knight can jump from square (r1, c1) to (r2, c2) if and only if (r1 - r2)2 + (c1 - c2)2 = 5.

In this problem, one of our knights is going to undertake a chivalrous quest of moving from the top-left corner (the (1, 1) square) to the bottom-right corner (the (H, W) square) on a gigantic board. The chessboard is of height H and width W.

Here are some restrictions you need to know.

1.The knight is so straightforward and ardent that he is only willing to move towards the right and the bottom. In other words, in each step he only moves to a square with a bigger row number and a bigger column number. Note that, this might mean that there is no way to achieve his goal, for example, on a 3 by 10 board.

2.There are R squares on the chessboard that contain rocks with evil power. Your knight may not land on any of such squares, although flying over them during a jump is allowed.

Your task is to find the number of unique ways for the knight to move from the top-left corner to the bottom-right corner, under the above restrictions. It should be clear that sometimes the answer is huge. You are asked to output the remainder of the answer when divided by 10007, a prime number.

INPUT

Input begins with a line containing a single integer, N. N test cases follow.

The first line of each test case contains 3 integers, H, W, and R. The next R lines each contain 2 integers each, r and c, the row and column numbers of one rock. You may assume that (1, 1) and (H, W) never contain rocks and that no two rocks are at the same position.

OUTPUT

For each test case, output a single line of output, prefixed by "Case #X: ", where X is the 1-based case number, followed by a single integer indicating the number of ways of reaching the goal, modulo 10007.

CONSTRAINTS

1 ≤ N ≤ 100

0 ≤ R ≤ 10

1 ≤ W ≤ 100

1 ≤ H ≤ 100

1 ≤ r ≤ H

1 ≤ c ≤ W

SAMPLE INPUT
2
1 1 0
4 4 1
2 1

SAMPLE OUTPUT
Case #1: 1
Case #2: 2
def table(height, width):
    t = []
    for i in range(height):
	t.append([])
	for j in range(width):
	    t[i].append(0)
    return t

def compute():
    h, w, r = map(int, raw_input().split())

    rocks = table(h, w)
    board = table(h, w)
    
    for i in range(r):
	rr, cc = map(int, raw_input().split())
	rocks[rr-1][cc-1] = 1
    
    board[0][0] = 1
    for i in range(h):
	for j in range(w):
	    if rocks[i][j] != 1:
		if i-2 >= 0 and j-1 >= 0:
		    board[i][j] += (board[i-2][j-1])
		    board[i][j] %= 10007
		if i-1 >= 0 and j-2 >= 0:
		    board[i][j] += (board[i-1][j-2])
		    board[i][j] %= 10007

    return board[h-1][w-1]


for i in range(input()):
    print "Case #%d: %d" % (i+1, compute())