func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 200000;   const long long mod = 1e9 + 7;   long long fac[maxn + 5], inv[maxn + 5];   long long f[2005];   struct node {     long long x, y;   } data[2005];   long long qmod(long long a, long long b) {     long long ans = 1;     a = a % mod;     while (b) {       if (b & 1) {         ans = (ans * a) % mod;       }       b = b / 2;       a = (a * a) % mod;     }     return ans;   }   void init() {     fac[0] = 1;     for (long long i = 1; i <= maxn; i++) {       fac[i] = (fac[i - 1] * i) % mod;     }   }   long long com(long long n, long long m) {     if (n < m)       return 0;     else if (n == m)       return 1;     else       return (fac[n] * qmod(fac[m] * fac[n - m], mod - 2)) % mod;   }   long long Lucas(long long n, long long m) {     if (m == 0)       return 1;     else       return (com(n % mod, m % mod) * Lucas(n / mod, m / mod)) % mod;   }   bool cmp(node a, node b) {     if (a.x < b.x)       return true;     else if (a.x == b.x) {       if (a.y < b.y)         return true;       else         return false;     } else       return false;   }   int main(int argc, char const *argv[]) {     long long h, w, n;     init();     scanf( %lld %lld %lld , &h, &w, &n);     for (int i = 1; i <= n; i++) {       scanf( %lld %lld , &data[i].x, &data[i].y);     }     sort(data + 1, data + 1 + n, cmp);     memset(f, 0, sizeof(f));     n++;     data[n].x = h;     data[n].y = w;     for (int i = 1; i <= n; i++) {       long long dx, dy;       dx = data[i].x - 1;       dy = data[i].y - 1;       f[i] = Lucas(dx + dy, dx);       for (int j = 1; j < i; j++) {         if (data[i].x >= data[j].x && data[i].y >= data[j].y) {           dx = data[i].x - data[j].x;           dy = data[i].y - data[j].y;           f[i] = f[i] - (f[j] * Lucas(dx + dy, dx)) % mod;           f[i] = (f[i] + mod) % mod;         }       }     }     cout << (f[n] + mod) % mod << endl;     return 0;   }   