You are given a square grid $$$h$$$ of size $$$n$$$ that needs to be filled with digits $$$0$$$ to $$$9$$$. For $$$h$$$ to be harmonic, it must follow certain rules.
The adjacent cells (cells that have a common edge) of $$$h$$$ should have a difference of no more than $$$1$$$.
Also, for any $$$2 \times 2$$$ square in $$$h$$$, the sum of elements on both of its diagonals should be equal. For example, $$$\begin{bmatrix}1 & 2\\ 0 & 1\end{bmatrix}$$$ has $$$1 + 1 = 2 + 0$$$.
For any rectangle, 2 quantities – $$$\text{next}$$$ and $$$\text{prev}$$$ – are defined as follows.
Note that for any rectangle, $$$\text{next} \gt \text{prev}$$$.
Any rectangle of dimension $$$l \times b$$$ is said to be a bad rectangle if the difference between the $$$\text{next}$$$ and $$$\text{prev}$$$ of this rectangle is equal to $$$l + b$$$. For example, $$$\begin{bmatrix}1\end{bmatrix}$$$, $$$\begin{bmatrix}1 & 2 & 3\end{bmatrix}$$$, $$$\begin{bmatrix}1 & 2 & 4\\ 3 & 4 & 2\end{bmatrix}$$$ are all examples of bad rectangles, but $$$\begin{bmatrix}2 & 2\\ 2 & 2\end{bmatrix}$$$ and $$$\begin{bmatrix}1 & 2 & 3\\ 4 & 5 & 6\end{bmatrix}$$$ are good rectangles.
You need to count the number of ways to fill a harmonic grid $$$h$$$ such that there are no bad rectangles with an area greater than $$$k$$$. Since the answer may be large, print it modulo $$$10^9 + 7$$$.
The only input line contains two integers $$$n\ (1 \le n \le 500)$$$ and $$$k\ (1 \le k \le n^2)$$$.
Print a single integer – the number of ways to fill a harmonic grid $$$h$$$ of size $$$n$$$ having no bad rectangles with an area greater than $$$k$$$.
2 1
10
2 3
46