ztr loves chess

Time Limit: 2000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5679
64-bit integer IO format: %I64d      Java class name: Main

Description

ztr loves chess. Not long ago he argued with Hillan the Rabbit that a knight is better than a king. To prove his point he tries to show that the knight is very fast but Hillan doesn't accept statements without evidence. He constructed an infinite chessboard for ztr, where he deleted several squares to add some more interest to the game. ztr only needs to count how many different board squares a knight standing on a square with coordinates of (0, 0) can reach in no more than k moves. Naturally, it is forbidden to move to the deleted squares.

ztr doesn't very much like exact sciences himself and he thinks it too simple so he doesn't want to program, that's why he will hardly be able to get ahead of Hillan who has already started solving the problem. Help ztr to solve the problem faster than Hillan.

Input

There are T cases $(1<=T<=10)$
For each case:
The first line contains two integers k and n $(0\leq\;k&#8201;\leq\;10^{18},&#8201;0&#8201;\leq\;&#8201;n\leq\;&#8201;440)$ which are correspondingly the maximal number of moves a knight can make and the number of deleted cells. Then follow n lines, each giving the coordinates of a deleted square in the form (xi,&#8201;yi) (|xi|&#8201;≤&#8201;10,&#8201;|yi|&#8201;≤&#8201;10). All the numbers are integer, the deleted squares are different and it is guaranteed that the square (0,&#8201;0) is not deleted.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

Output

You must print the answer on a single line. As it can be rather long, you should print it modulo 1000000007.

Sample Input

1
2 7
-1 2
1 2
2 1
2 -1
1 -2
-1 -2
-2 -1

Sample Output

9

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .