Statement 

Given N,A,B,C, find how many solutions exist to the equation : a + b + c ≤ N, such that 0 ≤ a ≤ A, 0 ≤ b ≤ B, 0 ≤ c ≤ C.


Input 

The first line contains the number of test cases T. Each test case contains 4 integers, N,A,B,C. 0 ≤ N,A,B,C ≤ 2500


Output 

Output T lines, one for each test case.


Sample Input 

2
4 3 2 1
1 1 1 1


Sample Output 

20
4
t=int(raw_input())
f = lambda z:((z+1)*(z+2)*(z+3))/6 if z>=0 else 0
while t:
    n,a,b,c=map(int, raw_input().split())
    a+=1
    b+=1
    c+=1
    print f(n)-f(n-a)-f(n-b)-f(n-c)+f(n-a-b)+f(n-a-c)-f(n-a-b-c)+f(n-b-c)
    t-=1