
import std.stdio;

void main() {
  int width, height;
  while(readf("%d %d\n", &width, &height), (width + height) != 0) {
    int[][] route = new int[][](width + 1, height + 1);
    int number;
    readf("%d\n", &number);
    for(int i, j, n = 0; n < number; n++) {
      readf("%d %d\n", &i, &j);
      route[i][j] = -1;
    }
    
    route[1][1] = 1;
  
    for(int i = 1; i <= width; i++) {
      for(int j = 1; j <= height; j++) {
        if (route[i][j] == -1) continue;
        if (route[i - 1][j] >= 0) route[i][j] += route[i - 1][j];
        if (route[i][j - 1] >= 0) route[i][j] += route[i][j - 1];
      }
    }
    writeln(route[width][height]);
  }
}