#P1176. 路径计数2

路径计数2

Description

On an N×NN \times N grid, you start at (1,1)(1, 1), the top-left corner. Each move, you may only go to the adjacent cell below or to the adjacent cell to the right. How many ways are there to reach (N,N)(N, N), the bottom-right corner?

However, this problem is too simple, so now there are MM cells with obstacles, meaning you cannot step on these MM cells.

Input Format

The first line contains two non-negative integers N,MN, M, representing the side length of the grid and the number of obstacles.

Then follow MM lines, each containing two positive integers x,yx, y that are not greater than NN. This means there is an obstacle at coordinate (x,y)(x, y) that cannot be passed, with 1x,yn1≤x, y≤n, and at least one of x,yx, y is greater than 11. Note that obstacle coordinates may be the same.

Output Format

A non-negative integer, which is the result of the answer mod100003\bmod 100003.

3 1
3 1
5

Hint

For 20%20\% of the testdata, N3N≤3.

For 40%40\% of the testdata, N100N≤100.

For 40%40\% of the testdata, M=0M=0.

For 100%100\% of the testdata, N1000,M100000N≤1000,M≤100000.

Translated by ChatGPT 5