marcel

Time limit: 1.5s Memory limit: 512MB Input: Output:

Ever since the exam session started, Marcel's son keeps attending parties over and over. This time around he's facing N2N^2 drinks arranged on NN lines, each line having NN drinks. We know the content of the drink on position (i,j)(i, j) as alcijalc_{ij} (integer which can be negative). In one sitting, our character can choose between doing one of the 44 actions:

  • Drinks all the drinks from the first line
  • Drinks all the drinks from the first column
  • Drinks all the drinks from the last line
  • Drinks all the drinks from the last column

Of course, in order to not face shame, he can't conduct an action which would result in him drinking less than XX units in one sitting. After the turn, the drinks will be eliminated from the grid and the party goes on. At any moment, our character can stop (mandatory when all drinks are gone).

Task

In the next day, Marcel found from trustworthy sources the values of NN, XX and alcalc and he's interested in finding the number of ways ANSANS in which the party could have gone, modulo 109+710^9 + 7. Two ways are considered distinct if there is a moment at which Marcel's son chose different actions among the 55 possible actions (the four actions resulting in him drinking, as well as stopping).

Input data

The first line will contain two numbers, NN and XX, separated by a space. NN lines, each of them containing NN integers follow. The jthj^{th} number from line ii represents the value of alcijalc_{ij}.

Output data

The first line will contain a single number, ANSANS, representing the number of ways in which the party can go, modulo 109+710^9 + 7.

Constraints and clarifications

  • 1N1201 \leq N \leq 120
  • 109X109-10^9 \leq X \leq 10^9
  • 106alcij106-10^6 \leq alc_{ij} \leq 10^6

Example 1

stdin

1 10
23

stdout

5

Explanation

In the first test case the party has only one round, in which the main character can choose between consuming 2323 units (possible in 44 distinct ways) or stopping right away.

Example 2

stdin

1 23
10

stdout

1

Explanation

In the second test case the consumption of only 1010 units would be shameful, so we only have the option of stopping right away.

Example 3

stdin

2 10
23 23
23 23

stdout

53

Example 4

stdin

3 4
1 4 2
3 9 -6
7 8 5

stdout

62

Log in or sign up to be able to send submissions!