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 f(n):
	if n<0:
		return 0
	x=((n+2)*(n+1)*(n+3))/6
	return x
t=input()
while t>0:
	n,a,b,c=map(int,raw_input().split())
	y=f(n)-f(n-a-1)-f(n-b-1)-f(n-c-1)+f(n-a-b-2)+f(n-a-c-2)+f(n-b-c-2)-f(n-a-b-c-3)
	print y
	t-=1