A mosquito mesh for a window is in the form of square grid of size n×n. As the mesh is quite old there are m holes in the mesh. A hole of size l in a mesh is a square region of side length l inside which all wires are broken. The centers of the holes lie on the main diagonal of the window.
There is an ant which is at S(0,0). It has to go to T(n,n). In a single step the ant can go either right or up. i.e. if the ant is at (x,y) it can go to either (x+1,y) or (x,y+1), but it is not allowed to go inside any hole or outside of the mesh. Count the number of distinct paths the ant can take to reach T from S .
Since the number of such paths can be very large you have to find the answer modulo 109+7
Note: Ant can move on the boundries of both hole or mesh. See the below figure for more clarity.
Constraints:
Input Format:
The first line contains two space-separated integers n and m denoting the size of the window and the number of holes respectively.
Next m lines contain two space-separated integer. ith line contains xi and li the x-coordinate of top-left corner of the ith hole and the size of hole respectively. i.e. The top-left corner of the ith hole is at (xi,n−xi) and the bottom right corner of the ith hole is at (xi+li,n−xi−li).
Output Format:
Output a single integer denoting the number of distinct paths to reach T from S . Since the output can be very large output the answer modulo 109+7
The image above corresponds to this testcase. The three paths P1,P2,P3 are few paths among 124231 possible paths. Note that ant can crawl on the boundaries of holes or window.