Given nonnegative integers N,L,Rand X find the maximum value of
∑i=1NAi
over all possible integer arrays A of length N satisfying
If there exists no valid array AA satisfying above requirements, output -1.
The first line contains an integer T. (1≤T≤3000), denoting the number of test cases.
For each test case, there is a line containing integers N,L,R,X(1≤N≤109, 0≤L≤R≤109, 0≤X≤109).
1
5 890 970 768
4756