Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an *h* × *w* field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only some of them are black. Currently Gerald is finishing a game of giant chess against his friend Pollard. Gerald has almost won, and the only thing he needs to win is to bring the pawn from the upper left corner of the board, where it is now standing, to the lower right corner. Gerald is so confident of victory that he became interested, in how many ways can he win?

The pawn, which Gerald has got left can go in two ways: one cell down or one cell to the right. In addition, it can not go to the black cells, otherwise the Gerald still loses. There are no other pawns or pieces left on the field, so that, according to the rules of giant chess Gerald moves his pawn until the game is over, and Pollard is just watching this process.
The first line of the input contains three integers: *h*, *w*, *n* — the sides of the board and the number of black cells (1 ≤ *h*, *w* ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *n* ≤ 2000). 

Next *n* lines contain the description of black cells. The *i*-th of these lines contains numbers *r*<sub class="lower-index">*i*</sub>, *c*<sub class="lower-index">*i*</sub> (1 ≤ *r*<sub class="lower-index">*i*</sub> ≤ *h*, 1 ≤ *c*<sub class="lower-index">*i*</sub> ≤ *w*) — the number of the row and column of the *i*-th cell.

It is guaranteed that the upper left and lower right cell are white and all cells in the description are distinct.
import bisect
import heapq
import sys
from types import GeneratorType
from functools import cmp_to_key
from collections import defaultdict, Counter, deque
import math
from functools import lru_cache
from heapq import nlargest
from functools import reduce
import random
from itertools import combinations
from itertools import accumulate
from operator import xor
from operator import mul
inf = float("inf")
PLATFORM = "CF"
if PLATFORM == "LUOGU":
    import numpy as np
    sys.setrecursionlimit(1000000)


class FastIO:
    def __init__(self):
        return

    @staticmethod
    def _read():
        return sys.stdin.readline().strip()

    def read_int(self):
        return int(self._read())

    def read_float(self):
        return float(self._read())

    def read_ints(self):
        return map(int, self._read().split())

    def read_floats(self):
        return map(float, self._read().split())

    def read_ints_minus_one(self):
        return map(lambda x: int(x) - 1, self._read().split())

    def read_list_ints(self):
        return list(map(int, self._read().split()))

    def read_list_floats(self):
        return list(map(float, self._read().split()))

    def read_list_ints_minus_one(self):
        return list(map(lambda x: int(x) - 1, self._read().split()))

    def read_str(self):
        return self._read()

    def read_list_strs(self):
        return self._read().split()

    def read_list_str(self):
        return list(self._read())

    @staticmethod
    def st(x):
        return sys.stdout.write(str(x) + '\n')

    @staticmethod
    def lst(x):
        return sys.stdout.write(" ".join(str(w) for w in x) + '\n')

    @staticmethod
    def round_5(f):
        res = int(f)
        if f - res >= 0.5:
            res += 1
        return res

    @staticmethod
    def max(a, b):
        return a if a > b else b

    @staticmethod
    def min(a, b):
        return a if a < b else b

    @staticmethod
    def bootstrap(f, queue=[]):
        def wrappedfunc(*args, **kwargs):
            if queue:
                return f(*args, **kwargs)
            else:
                to = f(*args, **kwargs)
                while True:
                    if isinstance(to, GeneratorType):
                        queue.append(to)
                        to = next(to)
                    else:
                        queue.pop()
                        if not queue:
                            break
                        to = queue[-1].send(to)
                return to
        return wrappedfunc


class Combinatorics:
    def __init__(self, n, mod):
        # 模板：求全排列组合数
        self.perm = [1] * n
        self.rev = [1] * n
        self.mod = mod
        for i in range(1, n):
            # 阶乘数 i! 取模
            self.perm[i] = self.perm[i - 1] * i
            self.perm[i] %= self.mod
        self.rev[-1] = pow(self.perm[-1], -1, self.mod)
        for i in range(n-2, 0, -1):
            self.rev[i] = (self.rev[i+1]*(i+1)%mod)
        return

    def comb(self, a, b):
        # 组合数根据乘法逆元求解
        res = self.perm[a] * self.rev[b] * self.rev[a - b]
        return res % self.mod


def main(ac=FastIO()):
    m, n, k = ac.read_ints()
    mod = 10**9 + 7
    cb = Combinatorics(m+n, mod)
    pos = [ac.read_list_ints_minus_one() for _ in range(k)]
    pos.sort(key=lambda it: it[0])

    def dist(x1, y1, x2, y2):
        return cb.comb(x2+y2-x1-y1, x2-x1)

    ans = dist(0, 0, m-1, n-1)
    bad = []
    for x in range(k):
        i, j = pos[x]
        cur = dist(0, 0, i, j)
        for y in range(x):
            a, b = pos[y]
            if b <= j:
                cur -= dist(a, b, i, j)*bad[y]
                cur %= mod
        bad.append(cur)
        ans -= cur*dist(i, j, m-1, n-1)
        ans %= mod
    ac.st(ans)
    return


main()
