#hhkb2020d. [hhkb2020_d]Squares

[hhkb2020_d]Squares

Problem Statement

Given are integers NN, AA, and BB.

We will place a white square whose side is of length NN on the coordinate plane so that the vertices are at (0,0)(0, 0), (N,0)(N, 0), (0,N)(0, N), and (N,N)(N, N).

Then, we will place a blue square whose side is of length AA and a red square whose side is of length BB so that these squares are inside the white square (including its boundary).

Here, each side of these squares must be parallel to the xx- or yy-axis.

Additionally, each vertex of red and blue squares must be at an integer point.

Find the number of ways to place red and blue squares so that they do not strictly overlap (they may share boundary with each other), modulo 1,000,000,0071,000,000,007.

Solve this problem for TT test cases in each input file.

Constraints

  • 1leqTleq1051 \\leq T \\leq 10^5
  • 1leqNleq1091 \\leq N \\leq 10^9
  • 1leqAleqN1 \\leq A \\leq N
  • 1leqBleqN1 \\leq B \\leq N
  • All values in input are integers.

Input

Input is given from Standard Input as follows. The first line of input is in the format below:

TT

Then, TT test cases follow, each of which is in the format below:

NN AA BB

Output

For each test case, print the number of ways to place red and blue squares so that they do not strictly overlap, modulo 1,000,000,0071,000,000,007. Use one line for each test case.


Sample Input 1

3
3 1 2
4 2 2
331895368 154715807 13941326

Sample Output 1

20
32
409369707

For example, in the first test case, there are 99 ways to place the blue squares and 44 ways to place the red squares, ignoring overlap.

Wherever we place the red square, there are 44 ways to place the blue square so that it strictly overlaps with the red square.

Thus, there are 9times44times4=209 \\times 4 - 4 \\times 4 = 20 ways to place red and blue squares so that they do not strictly overlap.

Note that the squares may share boundary with each other. For example, when the bottom-left vertices of blue and red squares are (0,0)(0, 0) and (0,1)(0, 1), respectively, the squares do not strictly overlap.