Task
In Junk Junction there is an infinite sequence of infinite matrices A1,A2,A3,…, which is defined in the following way:
An[i][j]=⎩⎨⎧0,1,∑k=1jAn−1[i][k],if j>iif j≤i and n=1if j≤i and n>1The 5×5 upper-left corners of the first 5 matrices will have the following values:
A1=1111101111001110001100001A2=1111102222003330004400005A3=1111103333006660001010000015A4=1111104444001010100002020000035A5=1111105555001515150003535000070Given 5 integers n, i1, j1, i2 and j2, determine the value of:
i=i1∑i2j=j1∑j2An[i][j]Since the answer can be very large, print its remainder modulo 109+7.
The first line of input contains a single integer t (1≤t≤105) - the number of test cases.
The first (and only) line of each test case contains 5 integers n, i1, j1, i2 and j2 (1≤n,i1,j1,i2,j2≤106, i1≤i2, j1≤j2).
Output data
For each test case, print the sum of the elements from the corresponding submatrix.
Since the answer can be very large, print its remainder modulo 109+7.
Example
stdin
6
2 2 1 4 4
1 3 2 4 5
3 1 1 5 5
5 3 2 5 4
1000000 1 2 1 1000000
15 11 9 25 20
stdout
19
5
70
130
0
335165324
Explanation
In the first test case, the submatrix from A2 whose corners are in (2,1), and (4,4), respectively, contains the following values:
111222033004The sum of these values is equal to: 1+1+1+2+2+2+3+3+4=19.
In the second test case, the submatrix from A1 whose corners are in (3,2), and (4,5), respectively, contains the following values:
[11110100]The sum of these values is equal to: 1+1+1+1+1=5.