func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   struct node {     int x, y;     bool operator<(const node &_) const {       return x < _.x || (x == _.x && y < _.y);     }   } A[2005];   int h, w, n;   long long dp[2005], jie[200005 << 1], inv[200005 << 1];   long long Pow(long long x) {     int n = mod - 2;     long long res = 1;     while (n) {       if (n & 1) res = res * x % mod;       x = x * x % mod;       n >>= 1;     }     return res;   }   void Init() {     jie[0] = inv[0] = 1;     for (int i = 1; i < 200005; i++) {       jie[i] = 1LL * jie[i - 1] * i % mod;       inv[i] = Pow(jie[i]);     }   }   long long C(int a, int b) {     return 1LL * jie[a] * inv[b] % mod * inv[a - b] % mod;   }   int main() {     Init();     scanf( %d%d%d , &h, &w, &n);     for (int i = 1; i <= n; i++) scanf( %d%d , &A[i].x, &A[i].y);     sort(A + 1, A + n + 1);     A[n + 1].x = h, A[n + 1].y = w;     for (int i = 1; i <= n + 1; i++) {       dp[i] = C(A[i].x + A[i].y - 2, A[i].x - 1);       for (int j = 1; j < i; j++) {         if (A[i].y < A[j].y) continue;         dp[i] = ((dp[i] -                   C(A[i].x - A[j].x + A[i].y - A[j].y, A[i].x - A[j].x) * dp[j]) %                      mod +                  mod) %                 mod;       }     }     cout << dp[n + 1] << endl;     return 0;   }   