Master Zhu and Math Problem

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

Master Zhu once came up with the following mathematical problem:

Given four integers, AA, BB, CC, and DD, how many different quadruples of integers (a,b,c,d)(a, b, c, d) are there which satisfy all the following conditions:

a+c>b+d a+db+c 0aA 0bB 0cC 0dD \begin{array}{c} a + c > b + d \\\ a + d \ge b + c \\\ 0 \le a \le A \\\ 0 \le b \le B \\\ 0 \le c \le C \\\ 0 \le d \le D \\\ \end{array}

Find the number of such quadruples. As the answer may be very large, it is sufficient to calculate it modulo 109+710^{9} + 7.

입력

The first line of input contains an integer TT, the number of test cases (1T10001 \le T \le 1000).

Each test case is given on a single line containing four integers AA, BB, CC, and DD (0A,B,C,D10180 \le A, B, C, D \le 10^{18}).

출력

For each test case, output a single line with a single integer: the answer modulo 109+710^{9} + 7.