Forgotten Homework

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

문제

Yesterday was a fun first day of University for Alice. She met so many new people, and there were so many activities to do! But her new teacher was super strict. It was her first day of university, and the teacher still gave them a lecture on linear algebra and matrix multiplication. And not only that, in order to test the new students, the teacher also gave them the following homework due to the next day.

You are given an n×nn \times n matrix AA and two indices ii and jj. Calculate the sequence A1(i,j),A2(i,j),...,A2n(i,j)A^1(i,j), A^2(i,j), ..., A^{2 n}(i,j) by hand. In other words, the element on row ii and column jj in each of the matrices A1,A2,...,A2nA^1, A^2, ..., A^{2 n}. Since these numbers can become very large, you should do all calculations modulo 109+710^9 + 7.

Alice, wanting to be a perfect student, definitely did not want to fail this task. So she stayed up all night yesterday doing matrix calculations. But oh no! In the morning, on her way to university, she realizes that she forgot to write down the last number A2n(i,j)A^{2n}(i, j). And now she has no time left to fix her mistake.

Help Alice calculate the number she is missing!

입력

The first line contains three integers nn and ii and jj (1n30001 \le n \le 3000, 1in1 \le i \le n, 1jn1 \le j \le n), given to Alice by her teacher. The second line contains the incomplete sequence of 2n12 n - 1 integers A1(i,j),A2(i,j),...,A2n1(i,j)A^1(i,j), A^2(i,j), ..., A^{2 n-1}(i, j) calculated by Alice (0Ak(i,j)<109+70 \leq A^k(i,j) < 10^9 + 7 for k=1,2,,2n1k = 1, 2, \ldots, 2 n - 1). You may assume that Alice made no mistakes calculating the incomplete sequence. The remaining nn lines of input each contain nn integers, giving the matrix AA.  The cc'th number in the rr'th of these lines is the entry A(r,c)A(r, c) in row rr column cc of AA (0A(r,c)<109+70 \leq A(r,c) < 10^9 + 7).

출력

Output the value of A2n(i,j)A^{2 n}(i, j) modulo 109+710^9 + 7.