#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10, MAXN = 2e5 + 10, mod = 1e9 + 7;
int dp[N], fc[MAXN], ifc[MAXN];
vector<pair<int, int> > bl;
int power(int a, int b) {
  if (!b) return 1;
  int rtr = power(a, b / 2);
  if (b % 2) return 1ll * rtr * rtr % mod * a % mod;
  return 1ll * rtr * rtr % mod;
}
void getFc() {
  fc[0] = ifc[0] = 1;
  for (int i = 1; i < MAXN - 5; i++) {
    fc[i] = 1ll * fc[i - 1] * i % mod;
    ifc[i] = 1ll * ifc[i - 1] * power(i, mod - 2) % mod;
  }
}
int ch(int x, int y) { return 1ll * fc[y] * ifc[x] % mod * ifc[y - x] % mod; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int x, y, n;
  cin >> x >> y >> n;
  x--, y--, bl.push_back({x, y});
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    x--, y--, bl.push_back({x, y});
  }
  getFc();
  sort(bl.begin(), bl.end());
  for (int i = 0; i < bl.size(); i++) {
    for (int j = 0; j < i; j++) {
      if (bl[i].second >= bl[j].second)
        dp[i] = (dp[i] + 1ll * dp[j] *
                             ch(bl[i].first - bl[j].first,
                                (bl[i].first + bl[i].second) -
                                    (bl[j].first + bl[j].second)) %
                             mod) %
                mod;
    }
    dp[i] = (ch(bl[i].first, bl[i].first + bl[i].second) - dp[i] + mod) % mod;
  }
  cout << dp[n];
  return 0;
}
