import std.stdio;
import std.algorithm;
import std.math;
import std.string;
import std.conv;
import std.range;

void main() {
    while (true) {
        int c, r;
        readf("%d %d\n", &c, &r);
        if (r == 0 && c == 0) break;

        int[][] map = new int[][](r + 1, c + 1);
        map[1][1] = 1;
        bool[][] bad = new bool[][](r + 1, c + 1);
        int n = readln.chomp.to!int;
        foreach (i; 0..n) {
            int x, y;
            readf("%d %d\n", &x, &y);
            bad[y][x] = true;
        }

        int[][] q = [[2,1], [1,2]];
        while (!q.empty) {
            int[] p = q.front;
            q.popFront;
            int y = p[0], x = p[1];
            if (bad[y][x])
                continue;
            map[y][x] = map[y-1][x] + map[y][x-1];
            bad[y][x] = true;
            if (y + 1 <= r) q ~= [y+1, x];
            if (x + 1 <= c) q ~= [y, x+1];
        }

        map[r][c].writeln;
    }
}