func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 10, Mod = 1e9 + 7;   long long fact[2 * MAXN], dp[MAXN], ps[MAXN], inv[MAXN * 2];   pair<long long, long long> a[MAXN];   long long power(long long x, long long y) {     if (!y) return 1;     long long ans = power(x, y / 2);     ans *= ans;     ans %= Mod;     if (y % 2) ans *= x;     ans %= Mod;     return ans;   }   long long c(int n, int r) {     long long ans = fact[n];     ans *= inv[r];     ans %= Mod;     ans *= inv[n - r];     ans %= Mod;     return ans;   }   int main() {     fact[0] = 1;     inv[0] = 1;     for (int i = 1; i < 2 * MAXN; i++) {       fact[i] = (fact[i - 1] * i) % Mod;       inv[i] = power(fact[i], Mod - 2);     }     int w, h, n;     cin >> w >> h >> n;     for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;     n++;     a[n].first = w;     a[n].second = h;     sort(a + 1, a + 1 + n);     for (int i = 1; i <= n; i++) {       dp[i] = c(a[i].first + a[i].second - 2, a[i].first - 1);       dp[i] %= Mod;       for (int j = 1; j < i; j++)         if (a[j].first <= a[i].first and a[j].second <= a[i].second) {           dp[i] -= dp[j] * c(a[i].first - a[j].first + a[i].second - a[j].second,                              a[i].first - a[j].first);           dp[i] %= Mod;           dp[i] += Mod;           dp[i] %= Mod;         }     }     cout << dp[n] << endl;     return 0;   }   