The Missing Pet

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

You are given an n×nn \times n chessboard, the rows and columns of which are numbered from 11 to nn respectively. Little Q punched several holes in specified locations: the ii-th hole is located at (r_i,c_i)(r\_i, c\_i).

Little Q also has a pet dog. Now, the dog is getting lost on the chessboard at the cell (r_0,c_0)(r\_0, c\_0). It will move to a random adjacent cell every second. Each of the adjacent cells is selected with equal probability. Here, two cells are adjacent if they share a common edge. If the dog arrives at a cell with a punched hole, it will fall into the hole.

Now, Little Q is wondering: for each hole, what is the expected number of seconds that the pet walks on the chessboard, given that it finally falls into this hole? Please help him.

입력

The first line contains an integer TT (1T201 \leq T \leq 20), the number of test cases. For each test case:

The first line contains two integers nn and kk (2n2002 \leq n \leq 200, 1k2001 \leq k \leq 200) indicating the size of the given chessboard and the number of holes.

Then kk lines follow, the ii-th of which contains two integers r_ir\_i and c_ic\_i (1r_i,c_in1 \leq r\_i, c\_i \leq n) indicating the location of the ii-th hole.

The last line of each test case contains two integers r_0r\_0 and c_0c\_0 (1r_0,c_0n1 \leq r\_0, c\_0 \leq n) denoting the starting location of the pet.

It is guaranteed that all given holes are distinct, and the pet is not located at a hole initially. It is also guaranteed that max(n,k)>5\max(n, k) > 5 holds in at most one test case.

출력

For each test case, output a single line with kk integers: for each hole, in the order they are given in the input, print the expected number of seconds the pet walks on the chessboard, given that it finally falls into this hole.

More precisely, if a hole is reachable and the reduced fraction of the expected number of seconds is pq\frac{p}{q}, you should output the minimum non-negative integer rr such that qrp(mod109+7)q \cdot r \equiv p \pmod{10^9+7}. You may safely assume that such rr always exists in all test cases. If a hole is unreachable, output "-1" instead.