F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

ztr loves chess

Time 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&#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
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 00:21:41, Gzip enabled