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
def nCr(n):
        if(n>=0): return ( (n+1) * (n+2) * (n+3) )/6
        else: return 0

def main():
        cases = int(raw_input())

        for i in range(cases):
                N,A,B,C = map(int,raw_input().split())
                solution = nCr(N) - nCr(N-A-1) - nCr(N-B-1) - nCr(N-C-1) + nCr(N-A-B-2) + nCr(N-A-C-2) + nCr(N-B-C-2) - nCr(N-A-B-C-3)
                print solution

main()