#d1202. 路径计数2

路径计数2

Path Counting 2

Problem Description

There is an n×nn \times n grid. Some cells are passable, and mm cells are obstacles.

You start at the top-left corner. In each step you may move down or right. Count the number of ways to reach the bottom-right corner.

Since the answer can be huge, output the result modulo 109+710^9+7.

Input Format

The first line contains two integers n,mn, m.

The next mm lines each contain two integers xi,yix_i, y_i, the coordinates of the ii-th obstacle.

Output Format

Output one number: the answer.

Sample Input

2 1
2 1

Sample Output

1

Constraints

All data guarantee 1≤n≤1061 \le n \le 10^6, 1≤m≤30001 \le m \le 3000, 1≤xi,yi≤n1 \le x_i, y_i \le n.