Chef's phone has a total storage of S MB. Also, Chef has 2 apps already installed on his phone which occupy X MB and Y MB respectively. 

He wants to install another app on his phone whose memory requirement is Z MB. For this, he might have to delete the apps already installed on his phone. Determine the minimum number of apps he has to delete from his phone so that he has enough memory to install the third app.

------ Input Format ------ 

- The first line contains a single integer T — the number of test cases. Then the test cases follow.
- The first and only line of each test case contains four integers S, X, Y and Z — the total memory of Chef's phone, the memory occupied by the two already installed apps and the memory required by the third app.

------ Output Format ------ 

For each test case, output the minimum number of apps Chef has to delete from his phone so that he can install the third app.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ S ≤ 500$
$1 ≤X ≤Y ≤S$
$X + Y ≤S$
$Z ≤S$

----- Sample Input 1 ------ 
4
10 1 2 3
9 4 5 1
15 5 10 15
100 20 30 75

----- Sample Output 1 ------ 
0
1
2
1

----- explanation 1 ------ 
Test Case 1: The unused memory in the phone is $7$ MB. Therefore Chef can install the $3$ MB app without deleting any app.

Test Case 2: There is no unused memory in the phone. Chef has to first delete one of the apps from the phone and then only he can install the $1$ MB app.

Test Case 3: There is no unused memory in the phone. Chef has to first delete both the apps from the phone and then only he can install the $15$ MB app.

Test Case 4: The unused memory in the phone is $50$ MB. Chef has to first delete the $30$ MB app from the phone and then only he can install the $75$ MB app.

Source: codechef | Difficulty: EASY


Solutions:
t = int(input())
for i in range(t):
	(s, x, y, z) = map(int, input().split())
	a = x + y
	if s - a >= z:
		print(0)
	elif s - a < z and s - x >= z or s - y >= z:
		print(1)
	else:
		print(2)


T = int(input(''))
for i in range(0, T):
	(s, x, y, z) = list(map(int, input().strip().split()))
	used = x + y
	rem = s - used
	if s >= used and s >= z:
		if z <= rem:
			print('0')
		else:
			used1 = s - min(x, y)
			if z <= used1:
				print('1')
			else:
				print('2')
	else:
		break


t = int(input())
for i in range(t):
	(s, x, y, z) = map(int, input().split(' '))
	remaining_space = s - (x + y)
	if remaining_space >= z:
		print('0')
	elif remaining_space + max(x, y) >= z:
		print('1')
	elif s >= z:
		print('2')


for i in range(int(input())):
	(S, X, Y, Z) = map(int, input().split())
	if Z <= S - X - Y:
		print(0)
	elif Z <= S - X or Z <= S - Y:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	(s, x, y, z) = map(int, input().split())
	if x + y + z <= s:
		print('0')
	elif x + z <= s or y + z <= s:
		print('1')
	else:
		print('2')


T = int(input())
for T in range(0, T):
	(S, X, Y, Z) = input().split()
	S = int(S)
	X = int(X)
	Y = int(Y)
	Z = int(Z)
	if S >= X + Y + Z:
		print(0)
	else:
		total = X + Y
		Storage = S - total
		noX = Storage + X
		noY = Storage + Y
		if noX >= Z or noY >= Z:
			print(1)
		elif Storage + total >= Z:
			print(2)


t = int(input())
i = 0
while i < t:
	(s, x, y, z) = map(int, input().split())
	a = x + y
	c = s - a
	if c >= z:
		print(0)
	elif c + x >= z or c + y >= z:
		print(1)
	else:
		print(2)
	i += 1


n = int(input())
for i in range(n):
	(s, x, y, z) = map(int, input().split())
	if x + y + z <= s:
		print('0')
	elif x + z <= s or y + z <= s:
		print('1')
	else:
		print('2')


t = int(input())
for i in range(t):
	(n, m, o, p) = map(int, input().split())
	a = m + o
	b = n - a
	if b >= p:
		print('0')
	elif p <= m or p <= o or p <= b + m or (p <= b + o):
		print('1')
	else:
		print('2')


t = int(input())
for i in range(t):
	ans = 0
	(S, X, Y, Z) = map(int, input().split())
	list1 = [X, Y]
	SpaceLeft = S - (X + Y)
	if SpaceLeft >= Z:
		ans = 0
	elif SpaceLeft + max(list1) >= Z:
		ans = 1
	else:
		ans = 2
	print(ans)


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	if b + c + d <= a:
		print('0')
	elif c + d <= a or b + d <= a:
		print('1')
	else:
		print('2')


t = int(input())
for i in range(0, t):
	d = input()
	d_list = d.split()
	s = int(d_list[0])
	x = int(d_list[1])
	y = int(d_list[2])
	z = int(d_list[3])
	if not (1 <= s <= 500 and 1 <= x <= y <= s and (x + y <= s) and (1 <= z <= s)):
		print('invalid')
	elif s - x - y >= z:
		print(0)
	elif z - (s - x - y) <= y:
		print(1)
	elif z - (s - x - y) <= x + y:
		print(2)


t = int(input())
for _ in range(t):
	(have, used1, used2, need) = map(int, input().split())
	if have - used1 - used2 >= need:
		print(0)
	elif have - used1 >= need or have - used2 >= need:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	(w, x, y, z) = map(int, input().split())
	if x + y + z <= w:
		print(0)
	elif x + z <= w and x + y + z > w:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	(s, x, y, z) = map(int, input().split())
	free_space = s - x - y
	if free_space >= z:
		print(0)
	elif s - min(x, y) >= z:
		print(1)
	else:
		print(2)


T = int(input())
for tc in range(T):
	(S, X, Y, Z) = map(int, input().split(' '))
	if Z <= S - X - Y:
		print('0')
	elif Z > S - X and Z > S - Y:
		print('2')
	else:
		print('1')


t = int(input())
while t:
	(s, x, y, z) = map(int, input().split())
	if x + y + z <= s:
		print('0')
	elif x + z <= s:
		print('1')
	else:
		print('2')
	t = t - 1


t = int(input())
for i in range(0, t):
	(s, x, y, z) = map(int, input().split())
	counter = 0
	n = x + y
	if s - (n + z) >= 0:
		print(0)
	elif s - (n + z) < 0:
		if s - n < z:
			counter = counter + 1
			n = n - max(x, y)
			if s - n < z:
				counter = counter + 1
				print(counter)
			else:
				print(counter)


for _ in range(int(input())):
	(S, X, Y, Z) = map(int, input().split())
	A = S - (X + Y)
	if Z <= A:
		print(0)
	else:
		B = Z - A
		if B <= X or B <= Y:
			print(1)
		else:
			print(2)


T = int(input())
for _ in range(T):
	(s, x, y, z) = map(int, input().split(' '))
	a = s - (x + y)
	if a >= z:
		print(0)
	elif z - a > y:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	(s, p, q, r) = map(int, input().split())
	if p + q + r <= s:
		print('0')
	elif p + r <= s or q + r <= s:
		print('1')
	else:
		print('2')