The universe is a 2D array of dimensions N∗M. You are standing in cell (1,1) at the start.
You can make a move in three different directions:
The biggest length of a move the man can make is K. If the current position of the man is (x,y), in a one-step he can go to:
In how many ways can you reach the cell (N,M)?
Since the solution can be very large, compute it modulo 109+7.
Input format
Output format
For each test case, output on a new line the count of ways to reach the cell (N,M) modulo 109+7.
Constraints
1≤Q,N,M,K≤1000
The sum of N∗M over all test cases won't exceed 108.
In the first query paths will be
(1,1)⇾(1,2)⇾(2,2)(1,1)⇾(2,1)⇾(2,2)(1,1)⇾(2,2)