func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int maxn = 1000010;   struct Point {     long long x, y;     Point() {}     Point(long long x, long long y) : x(x), y(y) {}     bool operator<(const Point &rhs) const {       if (x == rhs.x) return y < rhs.y;       return x < rhs.x;     }   } p[5000];   long long fac[maxn];   long long powmod(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = res * a % mod;       a = a * a % mod;       b >>= 1;     }     return res;   }   long long C(long long n, long long m) {     if (m > n || m < 0) return 0;     long long s1 = fac[n], s2 = fac[m] * fac[n - m] % mod;     return s1 * powmod(s2, mod - 2) % mod;   }   long long dp[maxn];   int n, m, k;   int main() {     fac[0] = 1LL;     for (int i = 1; i < maxn; i++) fac[i] = fac[i - 1] * i % mod;     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= k; i++) {       scanf( %lld%lld , &p[i].x, &p[i].y);       p[i].x--, p[i].y--;     }     p[++k].x = n - 1;     p[k].y = m - 1;     sort(p + 1, p + k + 1);     for (int i = 1; i <= k; i++) {       dp[i] = C(p[i].x + p[i].y, p[i].x);       for (int j = 1; j < i; j++) {         if (p[j].y <= p[i].y) {           dp[i] += (mod - dp[j] * C(p[i].x - p[j].x + p[i].y - p[j].y,                                     p[i].x - p[j].x));           dp[i] %= mod;         }       }     }     printf( %lld n , (dp[k] + mod) % mod);   }   