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 fact[200010], inv[200010];   inline long long MOD(long long x) {     while (x < 0) x += mod;     return x % mod;   }   long long binpow(long long a, int k) {     if (k == 0) return 1;     long long ans = binpow(a, k / 2);     ans = 1ll * ans * ans % mod;     if (k % 2) ans = 1ll * ans * a % mod;     return ans;   }   long long C(long long n, long long k) {     if (k > n) return 0;     long long ans = fact[n] * 1ll * inv[k] % mod;     ans = 1ll * ans * inv[n - k] % mod;     return ans % mod;   }   void pre() {     fact[0] = inv[0] = 1;     for (int i = 1; i < 200010; i++) {       fact[i] = 1ll * i * fact[i - 1] % mod;       inv[i] = binpow(fact[i], mod - 2);     }   }   int main() {     pre();     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;   }   