1 #include<cstdio>
2 #include<algorithm>
3 #include<cstring>
4 #include<cmath>
5 #include<iostream>
6 #define mod 1000003
7 #define ll long long
8 #define Q 2007
9 using namespace std;
10
11 int n,m,q;
12 ll p[mod+7],inv[mod+7],dp[Q];
13 struct Node
14 {
15 int x,y;
16 }a[Q];
17
18 bool cmp(Node x,Node y)
19 {
20 return x.x<y.x;
21 }
22 ll ksm(ll a,ll b)
23 {
24 ll ans=1;
25 while (b)
26 {
27 if (b&1) ans=a*ans%mod;
28 b/=2;
29 a=a*a%mod;
30 }
31 return ans;
32 }
33 ll Lucas_C(int n,int m)
34 {
35 if (n<m) return 0;
36 if (m==0) return 1;
37 if (n==m) return 1;
38 if (n<mod) return p[n]*inv[m]%mod*inv[n-m]%mod;
39 else return Lucas_C(n%mod,m%mod)*Lucas_C(n/mod,m/mod)%mod;
40 }
41 int main()
42 {
43 p[1]=1;
44 for (int i=2;i<=mod;i++)
45 p[i]=(p[i-1]*i)%mod;
46 for (int i=1;i<=mod;i++)
47 inv[i]=ksm(p[i],mod-2);
48 scanf("%d%d%d",&n,&m,&q);
49
50 for (int i=1;i<=q;i++)
51 scanf("%d%d",&a[i].x,&a[i].y);
52 q++,a[q].x=n+1,a[q].y=m+1;
53 sort(a+1,a+q+1,cmp);
54 for (int i=1;i<=q;i++)
55 {
56 dp[i]=Lucas_C(a[i].y-1,a[i].x-1);
57 for (int j=1;j<i;j++)
58 if (a[i].x>a[j].x&&a[i].y>a[j].y)
59 dp[i]=(dp[i]-dp[j]*Lucas_C(a[i].y-a[j].y-1,a[i].x-a[j].x-1)%mod+mod)%mod;
60 }
61 printf("%lld",dp[q]);
62 }