#include<iostream>
#include<utility>
using namespace std;
typedef long long ll;
#define fi(i,a,b) for(int i = a; i <= b; ++i)
#define fr(i,a,b) for(int i = a; i >= b; --i)
#define x first
#define y second
#define sz(x) ((int)(x).size())
#define pb push_back
using pii = pair<int,int>;
//#define DEBUG
const int N = 100003;
int obs[1005][1005];
int dp[1005][1005];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n >> m;
while(m--){
int x,y;
cin >> x >> y;
obs[x][y]++;
}
dp[1][1] = 1;
fi(i,1,n) fi(j,1,n) if(!obs[i][j]) dp[i][j] = (dp[i][j] + dp[i-1][j] + dp[i][j-1]) % N;
cout << dp[n][n] << endl;
#ifdef DEBUG
//freopen(D:\in.txt,r,stdin);
#endif
return 0;
}