Nature photographing may be fun for tourists, but it is one of the most complicated things for photographers. To capture all the facets of a bird, you might need more than one cameras. You recently encountered such a situation.
There are $n$ photographers, so there are $n$ cameras in a line on the x-axis. All the cameras are at distinct coordinates. 
You want to pair up these cameras ($n$ is even) in such a way that the sum of angles subtended on the bird by the pair of cameras is maximized. Formally, let A, B be two cameras, and let P be the bird to be captured by these two cameras. The angle will APB. 
Note: All angles are in radians.

-----Input-----
- The first line of the input contains an integer $T$ denoting the number of test cases. The description of the test cases follows.
- The first line of each test case contains an integer $n$.
- The second line of each test case contains $n$ space-separated integers denoting the $x_i$ coordinates of the cameras.
- The third line of each test case contains two space-separated integers $P, Q$ denoting the x and y coordinates of the bird respectively.

-----Output-----
For each test case, output your answer in a single line. Your answer would be considered correct if its absolute error is less than or equal to 1e-6 of the actual answer. 

-----Constraints-----
- $1 \le T \le 10$
- $2 \le n \leq  100$
- $1 \le x_i \leq 300$
- $0 \le P \leq 300$
- $1 \le Q \leq 300$

-----Example Input-----
2
2
0 1
0 1
2
0 1
100 1

-----Example Output-----
0.785398163397
0.000100999899

-----Explanation-----
Note: $1 \leq x_i$ is not being satisfied by the sample input, but will be satisfied in the actual test data.
Testcase 1: There are only 2 cameras, so they have to paired up with each other. And the angle subtended by then is 45 degrees. Converting this to radians gives the output.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from math import *
from collections import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	(p, q) = map(int, input().split())
	s = 0
	a.sort()
	for i in range(n // 2):
		x = a[i]
		x1 = a[n - i - 1]
		if x == p or x1 == p:
			s1 = abs(x - x1)
			s2 = q
			s += abs(atan2(s1, s2))
		elif x < p and x1 > p:
			s1 = abs(p - x)
			ex = atan2(s1, q)
			s1 = abs(p - x1)
			ex1 = atan2(s1, q)
			ex += ex1
			s += abs(ex)
		elif p < x:
			s1 = abs(p - x)
			ex = atan2(s1, q)
			s1 = abs(p - x1)
			ex1 = atan2(s1, q)
			ex = ex1 - ex
			s += abs(ex)
		else:
			s1 = abs(p - x)
			ex = atan2(s1, q)
			s1 = abs(p - x1)
			ex1 = atan2(s1, q)
			ex = ex - ex1
			s += abs(ex)
	print(s)


inp = input
import math
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(p, q) = map(int, input().split())
	ans = 0
	arr.sort()
	for i in range(n // 2):
		(mn, mx) = (arr[i], arr[n - i - 1])
		if mx == p or mn == p:
			adj = q
			opp = mx - mn
			val = math.atan2(opp, adj)
		elif mn < p and mx > p:
			adj = q
			opp = p - mn
			valA = math.atan2(opp, adj)
			opp = mx - p
			valB = math.atan2(opp, adj)
			val = valA + valB
		elif p < mn:
			adj = abs(mx - p)
			opp = q
			valA = math.atan2(opp, adj)
			adj = abs(mn - p)
			valB = math.atan2(opp, adj)
			val = valA - valB
		else:
			adj = abs(p - mn)
			opp = q
			valA = math.atan2(opp, adj)
			adj = abs(p - mx)
			valB = math.atan2(opp, adj)
			val = valA - valB
		val = abs(val)
		ans += val
	print('%.12f' % ans)


import math

def ar(a, b, c):
	s = (a + b + c) / 2
	return math.sqrt(s * (s - a) * (s - b) * (s - c))

def dist(x1, y1, x2, y2):
	return math.sqrt((y2 - y1) ** 2 + (x2 - x1) ** 2)

def return_angle(a, b, c):
	return math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))
from math import asin
t = int(input())
for _ in range(t):
	n = int(input())
	it = list(map(int, input().split()))
	(x, y) = map(int, input().split())
	it.sort()
	tot = 0
	vis = [0] * n
	pp = []
	for i in range(n):
		for j in range(i + 1, n):
			a = it[i]
			b = it[j]
			d = abs(a - b)
			d1 = dist(a, 0, x, y)
			d2 = dist(b, 0, x, y)
			ans = return_angle(d1, d2, d)
			ans = abs(ans)
			pp.append([ans, i, j])
	pp.sort(reverse=True)
	for i in pp:
		if vis[i[1]] or vis[i[2]]:
			continue
		tot += i[0]
		vis[i[2]] = 1
		vis[i[1]] = 1
	print(tot)


import math

def calLen(cam1, cam2, bird):
	a = math.sqrt((cam1[0] - bird[0]) ** 2 + (cam1[1] - bird[1]) ** 2)
	b = math.sqrt((cam2[0] - bird[0]) ** 2 + (cam2[1] - bird[1]) ** 2)
	c = math.sqrt((cam1[0] - cam2[0]) ** 2 + (cam1[1] - cam2[1]) ** 2)
	return (a, b, c)
for h in range(int(input())):
	n = int(input())
	cams = list(map(lambda x: [int(x), 0], input().strip().split()))
	bird = list(map(int, input().strip().split()))
	cams.sort(key=lambda x: x[0])
	ans = 0
	for i in range(n // 2):
		cam1 = cams[i]
		cam2 = cams[n - 1 - i]
		(a, b, c) = calLen(cam1, cam2, bird)
		ans += math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))
	print(ans)


import math

def calLen(cam1, cam2, bird):
	a = math.sqrt((cam1[0] - bird[0]) ** 2 + (cam1[1] - bird[1]) ** 2)
	b = math.sqrt((cam2[0] - bird[0]) ** 2 + (cam2[1] - bird[1]) ** 2)
	c = math.sqrt((cam1[0] - cam2[0]) ** 2 + (cam1[1] - cam2[1]) ** 2)
	return (a, b, c)

def calculateAngle(a, b, c):
	return math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))

def angle2(cam1, cam2, bird):
	(a, b, c) = calLen(cam1, cam2, bird)
	return math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))

def backtrack(s, vertices, order):
	global res
	flag9 = 0
	for a in range(0, len(vertices)):
		if vertices[a] != 0:
			flag9 = 1
			break
	if flag9 == 0:
		res = max(s, res)
		return
	for a in range(0, len(vertices)):
		for b in range(0, len(vertices)):
			if vertices[a] and vertices[b]:
				n1 = vertices[a]
				n2 = vertices[b]
				vertices[a] = 0
				vertices[b] = 0
				backtrack(s + angle2(n1, n2, bird), vertices, order + [vertices[a], vertices[b]])
				vertices[a] = n1
				vertices[b] = n2
from random import randint
for h in range(int(input())):
	n = int(input())
	cams = list(map(lambda x: (int(x), 0), input().strip().split()))
	cams1 = [i for i in cams]
	bird = list(map(int, input().strip().split()))
	ans = 0
	i = 0
	i2 = [0, 0]
	i4 = [0, 0]
	while set(cams1) != {0}:
		i = 0
		for a in range(0, len(cams1)):
			for b in range(a + 1, len(cams1)):
				if cams1[a] and cams1[b]:
					if abs(cams1[a][0] - cams1[b][0]) >= i:
						i = abs(cams1[a][0] - cams1[b][0])
						i2 = [cams1[a], cams1[b]]
						i4 = [a, b]
		ans += angle2(i2[0], i2[1], bird)
		cams1[i4[0]] = 0
		cams1[i4[1]] = 0
	print(ans)
	res = 0


import math
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 0
	(p, q) = map(int, input().split())
	for i in range(n // 2):
		a = ar[i]
		b = ar[-(i + 1)]
		t1 = math.atan((p - a) / q)
		t2 = math.atan((b - p) / q)
		ans += t1 + t2
	print(ans)


t = int(input())
import math
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(p, q) = map(int, input().split())
	i = 0
	j = -1
	c = 0
	while True:
		if l[i] > l[j]:
			break
		a = math.sqrt((p - l[i]) ** 2 + q ** 2)
		b = abs(l[i] - l[j])
		d = math.sqrt((p - l[j]) ** 2 + q ** 2)
		e = a ** 2 + d ** 2 - b ** 2
		e /= 2 * a * d
		e = math.acos(e)
		round(e, 6)
		c += e
		i += 1
		j -= 1
	round(c, 6)
	print(c)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(x, y) = map(int, input().split())
	ans = 0
	for i in range(n // 2):
		a = l[i]
		b = l[i + n // 2]
		theta1 = (b - x) / y
		theta2 = (a - x) / y
		theta1 = atan(theta1)
		theta2 = atan(theta2)
		ans += theta1 - theta2
	print(abs(ans))


from math import atan
t = int(input())

def f(a, b, x, y):
	m = (b - x) / y
	n = (a - x) / y
	return atan(m) - atan(n)
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	(p, q) = map(int, input().split())
	k = n // 2
	s = 0
	for j in range(k):
		s = s + f(a[j], a[n - 1 - j], p, q)
	if s < 0:
		s = -s
	print(s)


from math import *
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l = list(map(int, input().split()))
	arr.sort()
	x = l[0]
	y = l[1]
	ans = 0
	for i in range(int(n / 2)):
		x1 = arr[i]
		x2 = arr[n - i - 1]
		if x1 < x and x2 <= x:
			angle = atan((x - x1) / y) - atan((x - x2) / y)
		elif x1 < x and x2 > x:
			angle = atan((x - x1) / y) + atan((x2 - x) / y)
		else:
			angle = atan((x2 - x) / y) - atan((x1 - x) / y)
		ans += angle
	print(ans)


import math
T = int(input())
for i in range(T):
	n = int(input())
	A = [int(k) for k in input().split()]
	A.sort()
	(P, Q) = [int(j) for j in input().split()]

	def angle(x1, x2, x, y):
		y = math.atan((x2 - x) / y) + math.atan((x - x1) / y)
		return y
	c = 0
	for i in range(n // 2):
		c = c + angle(A[i], A[n - i - 1], P, Q)
	print(c)


import math
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(p, q) = map(int, input().split())
	k = []
	for i in range(n):
		if p == arr[i]:
			k.append(0)
		else:
			k.append(math.atan((p - arr[i]) / q))
	k = sorted(k)
	print(round(abs(sum(k[:n // 2]) - sum(k[n // 2:])), 12))


import math
for i in range(int(input())):
	n = int(input())
	tmp = input().split()
	arr = []
	for j in tmp:
		arr.append(int(j))
	tmp = input().split()
	x = int(tmp[0])
	y = int(tmp[1])
	s = 0
	arr.sort()
	for j in range(int(n / 2)):
		d1 = (arr[j] - x) ** 2 + y ** 2
		d2 = (arr[n - j - 1] - x) ** 2 + y ** 2
		d3 = (arr[n - 1 - j] - arr[j]) ** 2
		s += math.acos((d1 + d2 - d3) / (2 * math.sqrt(d1) * math.sqrt(d2)))
	print('{0:0.12}'.format(s))


import math
for _ in range(int(input())):
	n = int(input())
	cameras = list(map(int, input().split()))
	(p, q) = map(int, input().split())
	cameras.sort()
	sumA = 0
	for i in range(n // 2):
		p1 = cameras[i]
		p2 = cameras[n - 1 - i]
		p12 = p2 - p1
		sideA = math.sqrt((p - p1) ** 2 + q ** 2)
		sideB = math.sqrt((p - p2) ** 2 + q ** 2)
		radians = math.acos((p12 ** 2 - sideA ** 2 - sideB ** 2) / (-2 * sideA * sideB))
		sumA += radians
	print(sumA)


from math import *
t = int(input())
for i in range(t):
	n = int(input())
	x = [float(y) for y in input().split()]
	x.sort()
	(p, q) = input().split()
	p = float(p)
	q = float(q)
	ma = 0.0
	for ind in range(n // 2):
		i = x[ind]
		j = x[n - ind - 1]
		t1 = t2 = pi / 2
		if i != p:
			t1 = atan(q / abs(i - p))
		if i > p:
			t1 = pi - t1
		if j != p:
			t2 = atan(q / abs(j - p))
		if j < p:
			t2 = pi - t2
		ma += pi - t1 - t2
	print(ma)


import math
for _ in range(int(input())):
	n = int(input())
	xs = list(map(int, input().split()))
	(p, q) = map(int, input().split())
	angles = sorted((math.atan((x - p) / q) for x in xs))
	print(sum(angles[n // 2:]) - sum(angles[:n // 2]))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(p, q) = list(map(int, input().split()))
	a = sorted(a)
	b = [0] * len(a)
	s = 0
	for i in range(len(a)):
		b[i] = a[i] - p
	for i in range(len(a) // 2):
		s = s - math.atan(b[i] / q) + math.atan(b[n - 1 - i] / q)
	print(s)


import math

def angle(x1, B, x2):
	(xb, yb) = B
	a = math.sqrt((xb - x1) ** 2 + yb ** 2)
	b = math.sqrt((xb - x2) ** 2 + yb ** 2)
	c = abs(x2 - x1)
	return math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))
for _ in range(int(input())):
	n = int(input())
	X = [int(x) for x in input().split()]
	B = [int(x) for x in input().split()]
	X.sort()
	(l, r) = (0, len(X) - 1)
	ang = 0
	while l < r:
		ang += angle(X[l], B, X[r])
		l += 1
		r -= 1
	print(ang)


from math import acos, sqrt
t = int(input())

def distance(x, y, p, q):
	a = abs(x - y)
	b = sqrt((p - x) ** 2 + q ** 2)
	c = sqrt((p - y) ** 2 + q ** 2)
	angle = acos((c ** 2 + b ** 2 - a ** 2) / (2 * b * c))
	return angle

def main():
	for _ in range(t):
		n = int(input())
		c = [int(x) for x in input().split()]
		(p, q) = map(int, input().split())
		c.sort()
		l = 0
		h = n - 1
		sum1 = 0
		while l < h:
			angle = distance(c[l], c[h], p, q)
			sum1 += angle
			l += 1
			h -= 1
		print(sum1)

def __starting_point():
	main()
__starting_point()