func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   vector<long long> fac, ifac;   long long fast_pow(long long a, long long b, long long mod) {     if (!b) return 1;     long long l = fast_pow(a, b >> 1, mod);     l = l * l % mod;     if (b & 1) l = l * a % mod;     return l;   }   long long nk(int n, int k) {     if (n - k < 0) return 0;     return fac[n] * ifac[k] % mod * ifac[n - k] % mod;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int h, w, n;     cin >> h >> w >> n;     int mx = 2 * max(h, w) + 1;     fac.resize(mx);     ifac.resize(mx);     fac[0] = ifac[0] = 1;     for (int i = 1; i < mx; ++i)       fac[i] = fac[i - 1] * i % mod, ifac[i] = fast_pow(fac[i], mod - 2, mod);     vector<pair<int, int> > bad(n);     for (auto &el : bad) cin >> el.first >> el.second;     sort(bad.begin(), bad.end());     auto f = [&](pair<int, int> &x, pair<int, int> &y) {       return x.first <= y.first && x.second <= y.second;     };     vector<long long> dp(n);     for (int i = 0; i < n; ++i) {       dp[i] = nk(bad[i].first + bad[i].second - 2, bad[i].first - 1);       for (int j = 0; j < i; ++j)         if (f(bad[j], bad[i])) {           long long x =               nk(bad[i].first - bad[j].first + bad[i].second - bad[j].second,                  bad[i].first - bad[j].first);           dp[i] = (dp[i] - (dp[j] * x % mod) + mod) % mod;         }     }     for (int i = 0; i < n; ++i)       dp[i] = dp[i] * nk(h + w - bad[i].first - bad[i].second, h - bad[i].first) %               mod;     long long ans = accumulate(dp.begin(), dp.end(), 0ll) % mod;     ans = (nk(h + w - 2, w - 1) - ans + mod) % mod;     cout << ans <<   n ;     return 0;   }   