You have 4 types of LegoTM blocks, of sizes (1 x 1 x 1), (1 x 1 x 2), (1 x 1 x 3), and (1
x 1 x 4). Assume that you have an infinite number of blocks of each type. For
brevity, we can call these types, respectively, the 1-block, 2-block, 3-block and 4-
block, or even (1), (2), (3) and (4). Select a color of your choice for each block.
Each size block will have the same color.
Using these blocks, build a visual model wall of height N and width M. The wall
will have one window of height, X and width Y. The wall should be structurally
connected, so no straight vertical should exist that would allow the wall to be
separated in two without cutting one or more bricks.
The first line contains the number of test cases T. T test cases follow. Each
case contains four integers, N and M (height & width of the wall) as well as
X and Y (height & width of window).
Output T lines, one for each test case, containing the number of ways to
build the wall.
As the numbers can be very large, output the result modulo 1,000,000,007.
The selected test case should visually display the wall (see sample pictures
1 ≤ T ≤ 100
1 ≤ N,M ≤ 1000
Minimum Challenge - Build the wall without Lego colors and without windows
Medium Challenge - Build the wall with Lego colors assigned
Ultimate Challenge - Build the wall with Lego color and also provision for window.
Sample Wall Pictures