#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const int maxn = 1e6 + 10;   const int md = 1e9 + 7;   long long FAC[maxn], iFAC[maxn];   long long dp[maxn];   vector<tuple<int, int>> a;   long long mpow(long long a, long long b) {     if (b == 0) return 1;     long long res = mpow(a, b / 2);     res *= res;     res %= md;     if (b & 1ll) {       res *= a;       res %= md;     }     return res;   }   long long inv(long long a) { return mpow(a, md - 2); }   void pre_calc() {     FAC[0] = FAC[1] = 1;     for (int i = 2; i <= 200000; i++) FAC[i] = (FAC[i - 1] * i) % md;     iFAC[0] = iFAC[1] = 1;     for (int i = 2; i <= 200000; i++) iFAC[i] = (iFAC[i - 1] * inv(i)) % md;   }   int T;   string str;   int x, y, n, m;   int nk;   void task() {     cin >> n >> m >> nk;     for (int i = 0; i < nk; ++i) {       cin >> x >> y;       --x;       --y;       a.emplace_back(x, y);     }     --n;     --m;     a.emplace_back(n, m);     sort(a.begin(), a.end());     for (int i = 0; i < a.size(); ++i) {       int xi = get<0>(a[i]), yi = get<1>(a[i]);       dp[i] = FAC[xi + yi] * iFAC[xi] % md * iFAC[yi] % md;       for (int j = 0; j < i; ++j) {         int xj = get<0>(a[j]), yj = get<1>(a[j]);         long long mul =             FAC[xi + yi - xj - yj] * iFAC[xi - xj] % md * iFAC[yi - yj] % md;         dp[i] = (dp[i] - dp[j] * mul % md) % md;       }     }     cout << (dp[a.size() - 1] + md) % md << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     pre_calc();     T = 1;     while (T--) {       task();     }     return 0;   }   