mod = 10**9+7

frac = [1]*200001

for i in range(2,200001):

    frac[i] = i * frac[i-1]%mod

fraci = [None]*200001

fraci[-1] = pow(frac[-1], mod -2, mod)

for i in range(-2, -200001-1, -1):

    fraci[i] = fraci[i+1] * (200001 + i + 1) % mod

def comb(a, b):

    if not a >= b >= 0:

        return 0

    return frac[a]*fraci[b]*fraci[a-b]%mod



def count(a, b):

    (r1, c1), (r2, c2) = RC[a], RC[b]

    if c2 < c1:

        return 0

    return comb(r2-r1 + c2-c1, r2-r1)



H, W, N = list(map(int, input().split()))



RC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]

RC.sort()



dpe = [0]*(N+2)

dpo = [0]*(N+2)

dpe[0] += 1



for i in range(1, N+2):

    rese = 0

    reso = 0

    for k in range(i):

        t = count(k, i)

        if not t:

            continue

        rese = (rese + t*dpo[k]) % mod

        reso = (reso + t*dpe[k]) % mod

    dpe[i] = rese

    dpo[i] = reso



print(((dpo[-1] - dpe[-1]) % mod))

mod = 10**9+7

frac = [1]*200001

for i in range(2,200001):

    frac[i] = i * frac[i-1]%mod

fraci = [None]*200001

fraci[-1] = pow(frac[-1], mod -2, mod)

for i in range(-2, -200001-1, -1):

    fraci[i] = fraci[i+1] * (200001 + i + 1) % mod

def comb(a, b):

    if not a >= b >= 0:

        return 0

    return frac[a]*fraci[b]*fraci[a-b]%mod



def count(a, b):

    (r1, c1), (r2, c2) = RC[a], RC[b]

    if c2 < c1:

        return 0

    return comb(r2-r1 + c2-c1, r2-r1)



H, W, N = list(map(int, input().split()))



RC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]

RC.sort()



dp = [0]*(N+2)

dp[0] += 1



for i in range(1, N+2):

    res = count(0, i)

    for k in range(1, i):

        res = (res - count(k, i)*dp[k]) % mod

    dp[i] = res



print((dp[-1]))

mod = 10**9 + 7
frac = [1] * 200001
for i in range(2, 200001):
    frac[i] = i * frac[i - 1] % mod
fraci = [None] * 200001
fraci[-1] = pow(frac[-1], mod - 2, mod)
for i in range(-2, -200001 - 1, -1):
    fraci[i] = fraci[i + 1] * (200001 + i + 1) % mod


def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a] * fraci[b] * fraci[a - b] % mod


def count(a, b):
    (r1, c1), (r2, c2) = RC[a], RC[b]
    if c2 < c1:
        return 0
    return comb(r2 - r1 + c2 - c1, r2 - r1)


H, W, N = list(map(int, input().split()))
RC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]
RC.sort()
dpe = [0] * (N + 2)
dpo = [0] * (N + 2)
dpe[0] += 1
for i in range(1, N + 2):
    rese = 0
    reso = 0
    for k in range(i):
        t = count(k, i)
        if not t:
            continue
        rese = (rese + t * dpo[k]) % mod
        reso = (reso + t * dpe[k]) % mod
    dpe[i] = rese
    dpo[i] = reso
print(((dpo[-1] - dpe[-1]) % mod))

mod = 10**9 + 7
frac = [1] * 200001
for i in range(2, 200001):
    frac[i] = i * frac[i - 1] % mod
fraci = [None] * 200001
fraci[-1] = pow(frac[-1], mod - 2, mod)
for i in range(-2, -200001 - 1, -1):
    fraci[i] = fraci[i + 1] * (200001 + i + 1) % mod


def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a] * fraci[b] * fraci[a - b] % mod


def count(a, b):
    (r1, c1), (r2, c2) = RC[a], RC[b]
    if c2 < c1:
        return 0
    return comb(r2 - r1 + c2 - c1, r2 - r1)


H, W, N = list(map(int, input().split()))
RC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]
RC.sort()
dp = [0] * (N + 2)
dp[0] += 1
for i in range(1, N + 2):
    res = count(0, i)
    for k in range(1, i):
        res = (res - count(k, i) * dp[k]) % mod
    dp[i] = res
print((dp[-1]))

-dpe = [0] * (N + 2) -dpo = [0] * (N + 2) -dpe[0] += 1 +dp = [0] * (N + 2) +dp[0] += 1 -    rese = 0 -    reso = 0 -    for k in range(i): -        t = count(k, i) -        if not t: -            continue -        rese = (rese + t * dpo[k]) % mod -        reso = (reso + t * dpe[k]) % mod -    dpe[i] = rese -    dpo[i] = reso -print(((dpo[-1] - dpe[-1]) % mod)) +    res = count(0, i) +    for k in range(1, i): +        res = (res - count(k, i) * dp[k]) % mod +    dp[i] = res +print((dp[-1]))