|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|7 초||64 MB||0||0||0||0.000%|
There is a grid that consists of W × H cells. The upper-left-most cell is (1, 1). You are standing on the cell of (1, 1) and you are going to move to cell of (W, H). You can only move to adjacent lower-left, lower or lower-right cells.
There are obstructions on several cells. You can not move to it. You cannot move out the grid, either. Write a program that outputs the number of ways to reach (W, H) modulo 1,000,000,009. You can assume that there is no obstruction at (1, 1).
The first line contains three integers, the width W, the height H, and the number of obstructions N. (1 ≤ W ≤ 75, 2 ≤ H ≤ 1018, 0 ≤ N ≤ 30) Each of following N lines contains 2 integers, denoting the position of an obstruction (xi, yi).
The last test case is followed by a line containing three zeros.
For each test case, print its case number and the number of ways to reach (W, H) modulo 1,000,000,009.
2 4 1 2 1 2 2 1 2 2 0 0 0
Case 1: 4 Case 2: 0