#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


const int mod=1000000007;
//const int mod=998244353;




long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}


vector<long long int> fact,fact_inverse;
template<typename type>
void tabulate(type n){
    fact.resize(n+1);
    fact_inverse.resize(n+1);
    fact[0]=1;
    fact_inverse[0]=binpow(1, mod-2, mod);
    for (int i=1; i<n+1; i++) {
        fact[i]=fact[i-1]*i;
        fact[i]%=mod;
        fact_inverse[i]=binpow(fact[i], mod-2, mod);
    }
}
template<typename type>
long long int nCk(type n,type k){
    return fact[n]*fact_inverse[n-k]%mod*fact_inverse[k]%mod;
}
template<typename type>
long long int nPk(type n,type k){
    return fact[n]*fact_inverse[n-k]%mod;
}

vpll p;
map<ll , ll> mp;
map<ll, bool> mark;
ll recur(ll n, ll m){
    if(mark[(n<<20)^m]){return mp[(n<<20)^m];}
    mark[(n<<20)^m]=true;
    ll ans=0;
    for(auto it: p){
        if(it.fi<=n&&it.se<=m){
            ans+=recur(it.fi,it.se)*nCk(n+m-it.fi-it.se,n-it.fi);
            ans%=mod;
        }
    }
    ans=(nCk(n+m,n)-ans+mod)%mod;
    mp[(n<<20)^m]=ans;
    return ans;
}

int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d,y,l,r;
    tabulate(3e5);
    cin >> a >> b >> m;
    p.resize(m);
    for(int i=0; i<m; i++){
        cin >> p[i].fi >> p[i].se;
        p[i].fi--;
        p[i].se--;
    }
    a--;b--;
    sort(all(p),[&](pll a, pll b){return a.fi+a.se<b.fi+b.se;});
    cout << recur(a,b) << el;
//    vll dp(m);
//    c=0;
//    d=0;
//    for(int i=0; i<m; i++){
//        d+=nCk(p[i].fi+p[i].se-2,p[i].fi-1)*nCk(a+b-p[i].fi-p[i].se,a-p[i].fi);
//        cout << d << el;
//        d%=mod;
//        for(int j=i+1; j<m; j++){
//            if(p[j].fi>=p[i].fi&&p[j].se>=p[i].se){
////                dp[j]=
//                d-=nCk(p[j].se+p[j].fi-p[i].se-p[i].fi,p[j].fi-p[i].fi)*
//                nCk(a+b-p[j].se-p[j].fi,a-p[j].fi)*nCk(p[i].fi+p[i].se-2,p[i].fi-1);
//                cout << d << el;
//                c%=mod;
//            }
//        }
//    }
//    cout << d << ' ' << c << el;
//    d=((d-c)%mod+mod)%mod;
//    c=nCk(a+b-2,a-1);
//    cout << c << el;
//    cout << ((c - d)%mod+mod)%mod << el;
    return 0;
}


Measured memory_bytes: 5376