
import std.stdio;

// [debug]
void dump(int[][] route, int height, int width) {
  for(int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      writef("%d%s", route[j][height - i - 1], (j == width - 1) ? "\n" : " ");
    }
  }
}

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

    for(int i = 0; i < width; i++)
      if (!zones[i][0])
        route[i][0] = 1;
    for(int j = 0; j < height; j++)
      if (!zones[0][j])
        route[0][j] = 1;
  
    for(int i = 1; i < width; i++) {
      for(int j = 1; j < height; j++) {
        if (zones[i][j]) continue;        
        if (zones[i - 1][j] && zones[i][j - 1]) route[i][j] = 0;
        else if (zones[i - 1][j]) route[i][j] = route[i][j - 1];
        else if (zones[i][j - 1]) route[i][j] = route[i - 1][j];
        else {
          route[i][j] = route[i - 1][j] + route[i][j - 1];
        }
      }
    }
    // dump(route, height, width);
    writeln(route[width - 1][height - 1]);
  }
}