func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   template <class T>   void out(T x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x > 9) out(x / 10);     putchar(x % 10 +  0 );   }   long long dp[2005];   struct node {     int x, y;   } a[2005];   bool cmp(node a, node b) {     if (a.x == b.x) return a.y < b.y;     return a.x < b.x;   }   long long O[201005], I[201005];   long long C(int a, int b) { return O[a] * I[b] % mod * I[a - b] % mod; }   int main() {     O[0] = 1;     for (int i = 1; i < 200105; i++) O[i] = O[i - 1] * i % mod;     I[0] = I[1] = 1;     for (int i = 2; i < 200105; i++) I[i] = mod / i * (mod - I[mod % i]) % mod;     for (int i = 1; i < 200105; i++) I[i] = I[i] * I[i - 1] % mod;     int h, w, n;     scanf( %d%d%d , &h, &w, &n);     for (int i = 0; i < n; i++) scanf( %d%d , &a[i].x, &a[i].y);     sort(a, a + n, cmp);     long long ans = C(h + w - 2, h - 1);     for (int i = 0; i < n; i++) {       dp[i] = C(a[i].x + a[i].y - 2, a[i].y - 1);       for (int j = 0; j < i; j++)         if (a[j].x <= a[i].x && a[j].y <= a[i].y) {           dp[i] = (dp[i] -                    dp[j] * C(a[i].x - a[j].x + a[i].y - a[j].y, a[i].x - a[j].x) +                    mod) %                   mod;         }       ans = (ans - dp[i] * C(h - a[i].x + w - a[i].y, h - a[i].x) + mod) % mod;     }     out((ans + mod) % mod);     return 0;   }   