H,W,K = map(int,input().split()) L = [list(map(int,input().split())) for _ in range(K)] L = [[L[i][0],L[i][1],L[i][0]+L[i][1]*10**(-11)] for i in range(K)] L.sort(key = lambda x:x[2]) L = [L[i][:2] for i in range(K)] MOD = 10**8+7 factorial = [1, 1] inverse = [1, 1] invere_base = [0, 1] for i in range(2, H+W + 1): factorial.append((factorial[-1] * i) % MOD) invere_base.append((-invere_base[MOD % i] * (MOD // i)) % MOD) #逆元 inverse.append((inverse[-1] * invere_base[-1]) % MOD) #階乗逆元 def nCr(n, r): if (r < 0 or r > n): return 0 r = min(r, n - r) return factorial[n] * inverse[r] * inverse[n - r] % MOD D = [0]*(1<