There are three squares, each with side length a placed on the x-axis. The coordinates of centers of these squares are (x1, a/2), (x2, a/2) and (x3, a/2) respectively. All of them are placed with one of their sides resting on the x-axis.
You are allowed to move the centers of each of these squares along the x-axis (either to the left or to the right)  by a distance of at most K. Find the maximum possible area of intersections of all these three squares that you can achieve. That is, the maximum area of the region which is part of all the three squares in the final configuration.

-----Input-----
- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains two space-separated integers a, K denoting side length of the squares, and the maximum distance that you can move the center of any square.
- The second line contains three space separated integers x1, x2, x3

-----Output-----
For each test case, output a real number corresponding to the maximum area of the intersection of the three squares that you can obtain. Your answer will be considered correct if it has an absolute error of less than or equal to 	10-2.

-----Constraints-----
- 1 ≤ T ≤ 105
- 1 ≤ a ≤ 105
- 0 ≤ K ≤ 106
- -106 ≤ x1, x2, x3 ≤ 106

-----Example-----
Input
3
1 0
1 2 3
1 1
1 2 3
1 1
1 4 6

Output
0.000000
1.0000
0.0

-----Explanation-----
Testcase 1: The figure below shows the three squares:

Since K = 0, they cannot be moved, and since there is no region which belongs to all three squares, the answer is 0.
Testcase 2: The starting configuration is the same as above, but now each of the squares can move 1 unit. So we can move the first square 1 unit to the right and the third square one unit to the left, and have all the three squares at x-coordinate = 2. Thus the entire square is part of all three squares, and the answer is 1.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
for i in range(t):
	(a, k) = list(map(int, input().split()))
	(x1, x2, x3) = list(map(int, input().split()))
	big = max(x1, x2, x3)
	small = min(x1, x2, x3)
	q = big - small - 2 * k
	if q >= a:
		print(0)
	elif -1 * q >= 0:
		print(a * a)
	else:
		print(a * (a - q))


for _ in range(int(input())):
	(l, k) = map(float, input().split())
	x = sorted(list(map(float, input().split())))
	(a, b, c) = (x[0], x[1], x[2])
	if c - a <= l:
		d = c - a
		if d <= 2 * k:
			print(l * l)
		else:
			d = l - (c - a) + 2 * k
			print(min(abs(d), l) * l)
	else:
		d = 2 * k - (c - a - l)
		if d <= 0:
			print(0.0)
		else:
			print(min(l, d) * l)


for _ in range(int(input())):
	(a, k) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	s = l[0] - a / 2 - k
	e = l[0] + a / 2 + k
	s = max(s, l[1] - a / 2 - k)
	e = min(e, l[1] + a / 2 + k)
	s = max(s, l[2] - a / 2 - k)
	e = min(e, l[2] + a / 2 + k)
	if s < e:
		ans = min(e - s, a) * a
	print(ans)


for i in range(int(input())):
	(a, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	l = sorted(l)
	if l[0] + a + 2 * k <= l[2]:
		print(0)
	elif l[0] + 2 * k >= l[2]:
		print(a ** 2)
	else:
		p = l[2] - l[0] - 2 * k
		print(a * (a - p))


t = int(input())
for o in range(t):
	(n, k) = list(map(int, input().split()))
	(x, y, z) = list(map(int, input().split()))
	(x1, y1) = (x - n / 2, x + n / 2)
	(x2, y2) = (y - n / 2, y + n / 2)
	(x3, y3) = (z - n / 2, z + n / 2)
	a = [(x1 - k, y1 + k), (x2 - k, y2 + k), (x3 - k, y3 + k)]
	a.sort()
	(x1, y1) = a[0]
	(x2, y2) = a[1]
	(x3, y3) = a[2]
	(f1, f2) = (max(x1, x2), min(y1, y2))
	ans = 0.0
	flag = False
	if f1 >= f2:
		flag = True
	else:
		f1 = max(f1, x3)
		f2 = min(f2, y3)
		if f1 >= f2:
			flag = True
	if flag:
		print(0 * 1.0)
		continue
	if f2 - f1 > n:
		print(n * n * 1.0)
	else:
		print((f2 - f1) * n * 1.0)


import sys
t = int(input())
while t:
	line = input().split()
	(a, k) = (int(line[0]), int(line[1]))
	line = input().split()
	arr = [int(line[0]), int(line[1]), int(line[2])]
	arr.sort()
	start = arr[0] - a / 2 - k
	end = arr[0] + a / 2 + k
	start = max(start, arr[1] - a / 2 - k)
	end = min(end, arr[1] + a / 2 + k)
	start = max(start, arr[2] - a / 2 - k)
	end = min(end, arr[2] + a / 2 + k)
	if start < end:
		ans = min(end - start, a) * a
	else:
		ans = 0
	sys.stdout.write('%.6f\n' % ans)
	t -= 1


for _ in range(int(input())):
	(a, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	p = l[0] + a / 2 + k
	q = l[2] - a / 2 - k
	print(format(0 if p < q else a * min(a, p - q), 'f'))


n = int(input())
for j in range(n):
	p = input().split(' ')
	a = int(p[0])
	k = int(p[1])
	x = input().split(' ')
	x1 = int(x[0])
	x2 = int(x[1])
	x3 = int(x[2])
	x = min(x1, x2, x3)
	y = max(x1, x2, x3)
	area = 0
	if y - x - 2 * k >= a:
		area = 0
	elif y - x <= 2 * k:
		area = a * a
	else:
		area = (a - (y - x - 2 * k)) * a
	print('{0:.2f}'.format(area))


t = int(input())

def shift(a, b, k):
	if k == 0:
		return a
	if k > abs(a - b):
		return b
	else:
		return a + (b - a) / abs(b - a) * k
while t > 0:
	(a, k) = map(int, input().split())
	vals = map(int, input().split())
	(x1, x2, x3) = sorted(vals)
	mid = (x1 + x3) / 2
	if x2 - x1 < a or x3 - x2 < a:
		overlapping = True
	x2 = shift(x2, mid, k)
	x1 = shift(x1, x2, k)
	x3 = shift(x3, x2, k)
	overlap = (a - (x3 - x1)) * a
	if overlap < 0:
		print(0)
	else:
		print(overlap)
	t -= 1


t = int(input())
for i in range(t):
	(a, k) = [float(i) for i in input().split()]
	p = [float(i) for i in input().split()]
	p.sort()
	(x1, x2, x3) = p
	x = min(x1 + 2 * k, x3)
	area = (a - (x3 - x)) * a
	if area <= 0:
		print(0)
	else:
		print(area)


T = int(input())
for j in range(T):
	ak = input()
	ip1 = ak.split(' ')
	a = float(ip1[0])
	k = float(ip1[1])
	x = input()
	ip2 = list(map(int, x.split()))
	ip2.sort()
	x1 = float(ip2[0])
	x2 = float(ip2[1])
	x3 = float(ip2[2])
	X1 = x1 + a / 2 + k
	X3 = x3 - a / 2 - k
	if X1 >= X3:
		if x3 - 2 * k - x1 <= 0:
			area = a * a
		else:
			a1 = X1 - X3
			area = a1 * a
	else:
		area = 0
	print('{0:.2f}'.format(float(area)))


for i in range(int(input())):
	(a, K) = list(map(int, input().split()))
	x = list(map(int, input().split()))
	x.sort()
	if x[2] - K - (x[0] + K) >= a:
		print('{0:.2f}'.format(float(0.0)))
	elif x[2] - K - (x[0] + K) <= 0:
		area = a * a
		print('{0:.2f}'.format(float(area)))
	else:
		area = abs(x[0] - x[2] + 2 * K + a) * a
		print('{0:.2f}'.format(float(area)))