1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cstring>
5 #include<cmath>
6 #include<cstdlib>
7 #include<vector>
8 using namespace std;
9 typedef long long ll;
10 typedef long double ld;
11 typedef pair<int,int> pr;
12 const double pi=acos(-1);
13 #define rep(i,a,n) for(int i=a;i<=n;i++)
14 #define per(i,n,a) for(int i=n;i>=a;i--)
15 #define Rep(i,u) for(int i=head[u];i;i=Next[i])
16 #define clr(a) memset(a,0,sizeof(a))
17 #define pb push_back
18 #define mp make_pair
19 #define fi first
20 #define sc second
21 #define pq priority_queue
22 #define pqb priority_queue <int, vector<int>, less<int> >
23 #define pqs priority_queue <int, vector<int>, greater<int> >
24 #define vec vector
25 ld eps=1e-9;
26 ll pp=1000000007;
27 ll mo(ll a,ll pp){if(a>=0 && a<pp)return a;a%=pp;if(a<0)a+=pp;return a;}
28 ll powmod(ll a,ll b,ll pp){ll ans=1;for(;b;b>>=1,a=mo(a*a,pp))if(b&1)ans=mo(ans*a,pp);return ans;}
29 void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
30 //void add(int x,int y,int z){ v[++e]=y; next[e]=head[x]; head[x]=e; cost[e]=z; }
31 int dx[5]={0,-1,1,0,0},dy[5]={0,0,0,-1,1};
32 ll read(){ ll ans=0; char last=‘ ‘,ch=getchar();
33 while(ch<‘0‘ || ch>‘9‘)last=ch,ch=getchar();
34 while(ch>=‘0‘ && ch<=‘9‘)ans=ans*10+ch-‘0‘,ch=getchar();
35 if(last==‘-‘)ans=-ans; return ans;
36 }
37 const int p=1000003;
38 struct node{
39 int a,b;
40 }f[3000];
41 bool cmp(node a,node b){
42 return (a.a<b.a)||(a.a==b.a && a.b<b.b);
43 }
44 ll dp[3000],fac[p],inv[p];
45 ll C(ll x,ll y){
46 if (y>x) return 0;
47 if (x<p && y<p) return fac[x]*inv[y]%p*inv[x-y]%p;
48 return C(x/p,y/p)*C(x%p,y%p)%p;
49 }
50 int main(){
51 int n=read(),m=read(),k=read();
52 for (int i=1;i<=k;i++) f[i].a=read(),f[i].b=read();
53 int i;
54 for (fac[0]=1,i=1;i<p;i++) fac[i]=fac[i-1]*i%p;
55 for (inv[1]=1,i=2;i<p;i++) inv[i]=(p-p/i)*inv[p%i]%p;
56 for (inv[0]=1,i=1;i<p;i++) inv[i]=inv[i-1]*inv[i]%p;
57 ll sum=C(m,n);
58 k++; f[k].a=n+1; f[k].b=m+1;
59 sort(f+1,f+k+1,cmp);
60 for (int i=1;i<=k;i++){
61 dp[i]=C(f[i].b-1,f[i].a-1);
62 for (int j=1;j<i;j++)
63 if (f[i].b>f[j].b && f[i].a>f[j].a)
64 dp[i]=((dp[i]-dp[j]*C(f[i].b-f[j].b-1,f[i].a-f[j].a-1)%p)%p+p)%p;
65 sum=((sum-dp[i]*C(m-f[i].b,n-f[i].a)%p)%p+p)%p;
66 }
67 printf("%lld",sum);
68 return 0;
69 }