func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MX = 2020;   const int MOD = 1e9 + 7;   const long long INF = 1061109567;   const long double EPS = 1e-9;   const long double PI = acos(-1);   const int MXX = 2e5 + 5;   long long F[MXX + 5], iF[MXX + 5];   long long qpow(long long b, long long e) {     if (!e) return 1LL;     if (e & 1) return (qpow(b, e - 1) * b) % MOD;     long long aux = qpow(b, e / 2);     return (aux * aux) % MOD;   }   long long invmod(long long n) { return qpow(n, MOD - 2); }   long long ways(int p, int q) {     if (p == 0 || q == 0) return 1;     long long ans = ((F[p + q] % MOD) * (iF[p] % MOD)) % MOD;     ans = ((ans % MOD) * (iF[q] % MOD)) % MOD;     return ans;   }   long long ways(int p, int q, int u, int v) { return ways(u - p, v - q) % MOD; }   pair<int, int> pt[MX];   long long dp[MX];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     iF[0] = F[0] = iF[1] = F[1] = 1LL;     for (int i = (2); i < (MXX); i++) {       F[i] = ((F[i - 1] % MOD) * (i % MOD)) % MOD;       iF[i] = ((iF[i - 1] % MOD) * (invmod(i) % MOD)) % MOD;     }     int h, w;     cin >> h >> w;     int n;     cin >> n;     n++;     pt[0].first = pt[0].second = 1;     for (int i = (1); i < (n); i++) {       cin >> pt[i].first >> pt[i].second;     }     sort(pt, pt + n);     for (int i = (n - 1); i >= (0); i--) {       dp[i] = ways(pt[i].first, pt[i].second, h, w);       for (int j = (i + 1); j < (n); j++) {         if (pt[j].second < pt[i].second) continue;         long long v =             ways(pt[i].first, pt[i].second, pt[j].first, pt[j].second) % MOD;         v = (v * dp[j]) % MOD;         dp[i] = (dp[i] + MOD - v) % MOD;       }     }     cout << dp[0];   }   