func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2005, M = 2000010;   const long long MOD = 1E9 + 7;   long long Pow(long long a, long long b) {     long long c = 1;     for (; b; a = a * a % MOD, b >>= 1)       if (b & 1) c = c * a % MOD;     return c;   }   struct Node {     int x, y;     bool operator<(const Node &a) const {       return (x != a.x) ? (x < a.x) : (y < a.y);     }   } p[N];   int h, w, n, m;   long long fac[M], fac_inv[M];   long long f[N];   void Init() {     fac[0] = 1;     for (int i = 1; i <= m; ++i) fac[i] = fac[i - 1] * i % MOD;     fac_inv[m] = Pow(fac[m], MOD - 2);     for (int i = m; i; --i) fac_inv[i - 1] = fac_inv[i] * i % MOD;     return;   }   inline long long F(int a, int b) {     return fac[a + b] * fac_inv[a] % MOD * fac_inv[b] % MOD;   }   int main() {     scanf( %d%d%d , &h, &w, &n);     m = h + w;     Init();     for (int i = 1; i <= n; ++i) scanf( %d%d , &p[i].x, &p[i].y);     sort(p + 1, p + n + 1);     for (int i = 1; i <= n; ++i) {       f[i] = F(p[i].x - 1, p[i].y - 1);       for (int j = 1; j < i; ++j)         if (p[j].y <= p[i].y)           f[i] = (f[i] + MOD - f[j] * F(p[i].x - p[j].x, p[i].y - p[j].y) % MOD) %                  MOD;     }     long long res = F(h - 1, w - 1);     for (int i = 1; i <= n; ++i)       res = (res + MOD - f[i] * F(h - p[i].x, w - p[i].y) % MOD) % MOD;     printf( %lld n , res);     return 0;   }   