#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n + 5][n + 5] = { 0 }, p[n + 5][n + 5] = { 0 }; int h, k; for (int i = 1; i <= m; i++) { cin >> h >> k; p[h][k] = 1; } if (p[1][1] == 1) { cout << 0; return 0; } // if (1) { int x = n + 1; for (int i = 1; i <= n; i++) if (p[1][i] == 1) { x = i; break; } for (int i = 1; i <= x - 1; i++) a[1][i] = 1; // } // if (1) { int y = n + 1; for (int i = 1; i <= n; i++) if (p[i][1] == 1) { y = i; break; } for (int i = 1; i <= y - 1; i++) a[i][1] = 1; // } for (int i = 2; i <= n; i++) { for (int j = 2; j <= n; j++) { if (p[i][j] == 1) a[i][j] = 0; else a[i][j] = (a[i - 1][j] + a[i][j - 1]) % 100003; } } cout << a[n][n]; return 0; }