|
||||||||||
ztr loves chessTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 219 Accepted Submission(s): 38 Problem 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 \leq\;10^{18}, 0 \leq\; n\leq\; 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, yi) (|xi| ¡Ü 10, |yi| ¡Ü 10). All the numbers are integer, the deleted squares are different and it is guaranteed that the square (0, 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
Sample Output
Source | ||||||||||
|