#include<bits/stdc++.h>
                                                        using namespace std;

                                                        #define FOR(i,a,b) for(int i = (a); i < (b); i++)
                                                        #define rep(i,n) FOR(i,0,n)
                                                        #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
                                                        #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
                                                        #define FILL(a, value) memset(a, value, sizeof(a)

                                                        #define SZ(a) (int)a.size()
                                                        #define ALL(a) a.begin(), a.end()
                                                        #define PB push_back
                                                        #define MP make_pair
                                                        #define er erase
                                                        #define in insert
                                                        #define f first
                                                        #define s second
                                                        #define sqr(x) ((x)*(x))





                                             typedef  long long LL;
                                                        typedef vector<int> VI;
                                                        typedef vector<LL > VL;
                                                        typedef vector<vector<int > > VVI;
                                                        typedef vector<vector<LL>> VVL;
                                                        typedef vector <vector<pair<int, int >> >VVPI;
                                                        typedef vector<vector<pair<LL, LL >> >VVPL;
                                                        typedef vector<pair<LL, LL >> PL;
                                                        typedef vector<PL> VPL;
                                                        typedef pair<int, int> PII;
                                                        typedef pair<LL,LL > PLL ;
                                                        typedef vector<PII> VPI;

                                                        const double PI = acos(-1.0);
                                                        const int INF = 1e9 * 2;
                                                        const LL LINF = (LL)1e18 ;

                                                        const double EPS = 1e-7;
                                                        const int MAS =  3 *1e5 + 10;
                                                        const int mod = 998244353;
                                                        const int MOD =1e9+7;
                                                        const int LOG= 19;
                                                        const int ar = 1e5 +100;
                                                        const int MAX = 1e6 + 1e2;
                                                        const int root = 0;




                                                        const int nax = 2 * 1e5 + 100 ;
                                                        int f[nax],inv_f[nax];


                                                        bool comperator(PII a, PII b)
                                                        {
                                                            return a.f + a.s  < b.f + b.s;
                                                        }
                                                        int mul(int a, int b)
                                                        {
                                                            return (LL ) a * b % MOD;
                                                        }
                                                        int bin (int a, int n)
                                                        {
                                                            int res =1;
                                                            while(n)
                                                            {
                                                                if(n & 1)res = mul(res,a);
                                                                a = mul(a,a);
                                                                n /=2;
                                                            }
                                                            return res;
                                                        }
                                                        int my_inv(int x)
                                                        {
                                                            return bin(x,MOD - 2);
                                                        }
                                                        int binomial(int a, int b)
                                                        {
                                                            if(a < 0 || b < 0 || b > a)return 0;
                                                            return mul(f[a],mul(inv_f[b],inv_f[a -b]));
                                                        }
                                                        int sub(int a , int b)
                                                        {
                                                            return (a - b + MOD)% MOD;
                                                        }
                                                        int func(int a, int b)
                                                        {
                                                            return binomial(a + b, b);
                                                        }
                                                        int main() {
                                                            ios_base::sync_with_stdio(false);
                                                            cin.tie(NULL);
                                                            // freopen("horrible.in","r",stdin);
                                                            // freopen("horrible.out","w",stdout);
                                                            int h,w,n;
                                                            cin >> h >> w >> n;
                                                            f[0] = inv_f[0] = 1;
                                                            FOR(i,1,nax)
                                                            {
                                                                f[i] = mul(f[i - 1],i);
                                                                inv_f[i] = my_inv(f[i]);
                                                            }
                                                            vector<PII > vec(n);
                                                            rep(i,n)
                                                            {
                                                                cin >> vec[i].f >> vec[i].s;
                                                            }
                                                            sort(ALL(vec),comperator);
                                                            vec.PB({h,w});
                                                            VI dp(n + 1);
                                                            rep(i,n + 1)
                                                            {
                                                                int tmp = func(vec[i].f -1, vec[i].s -1);
                                                                FOR(j,0,i)
                                                                {
                                                                    if(vec[j].f <= vec[i].f && vec[j].s <= vec[i].s)
                                                                    {
                                                                        tmp = sub(tmp,mul(dp[j],func(vec[i].f - vec[j].f,vec[i].s - vec[j].s)));
                                                                    }
                                                                }
                                                                dp[i] = tmp;
                                                            }
                                                            cout << dp[n];


                                                        }


Measured memory_bytes: 1920