Tanish is the president of the chemistry club at his school. He considers everyone who doesn't like chemistry as his enemy. After years of research, he has invented a lethal poison, which he named success. Now Tanish plans to kill all his enemies with his success. Success is extremely deadly and is untraceable in small concentrations.
Tanish has $\text{N}$ flasks lying on the shelf of his lab. All of these flasks contain the same volume of poison solution. The concentration of poison in the $\text{ith}$ flask is $\mathbf{a_i}$. In one move - Tanish picks up any two flasks, pours half of the contents of each of these flasks into a third initially empty flask, discards the two flasks and places the third flask (which now has the same volume of solution as all other flasks) on the shelf. He performs N-1 such moves to end up with only one flask of poison on the shelf. He wishes to perform these moves such that the concentration of poison in this flask is the minimum possible. What is the minimum concentration of poison that he can achieve?

-----Input-----
First line of the input contains a single integer $\text{T}$ - the number of test cases. 
For each test case,
The first line contains a single integer $\text{N}$, the number of bottles. 
The second line contains N space-separated integers, the concentrations. 

-----Output-----
For each test case, print one line containing the lowest final concentration. The output will be accepted if the absolute error is $\leq 10^{-6}$.

-----Constraints-----
$1 \leq \text{T} \leq 10$
$2 \leq \text{N} \leq 10^4$
$0 \leq \mathbf{a_i} \leq 10^9$

-----Sample Input-----
2
2
9 3
3
3 2 9

-----Sample Output-----
6.00000000
4.00000000

-----Explanation-----
In test 1, Tanish mixes flasks 1 and 2. In test 2, he first mixes flasks 1 and 3 to get a flask of concentration 6 and then mixes this flask with flask 2 to get a flask of poison concentration 4.    

-----Note-----
The concentration is given in the unit ppb i.e. parts per billion.
1 gram poison in $10^9$ ml solution is 1 ppb.
Concentration in ppb = (Number of grams of poison / Volume of solution in ml) x $10^9$

Source: codechef | Difficulty: EASY
Tags: Sorting

Greedy algorithms


Solutions:
n = int(input())
re = []
testCases = []
for i in range(n):
	re.append(int(input()))
	testCases.append(list(map(int, input().split())))
for tc in testCases:
	tc.sort()
	tc.reverse()
	temp = (tc[0] + tc[1]) / 2
	if len(tc) > 2:
		for i in range(2, len(tc)):
			temp = (temp + tc[i]) / 2
	print(temp)


try:
	T = int(input())
	for i in range(T):
		n = int(input())
		path = [int(i) for i in input().strip().split(' ')]
		path.sort(reverse=True)
		count = 0
		for i in range(n - 1):
			res = (path[i] + path[i + 1]) / 2
			count = count + res
			path[i + 1] = res
		print('%.8f' % res)
except EOFError:
	pass


def solve(num, l):
	l.sort()
	mini = pow(10, 6)
	i = len(l) - 1
	while len(l) > 1:
		n1 = l[i]
		n2 = l[i - 1]
		su = (n1 + n2) / 2
		del l[i]
		del l[i - 1]
		l.append(su)
		i = len(l) - 1
	return l[0]
n = int(input())
results = []
for i in range(0, n):
	num = int(input())
	l = list(map(int, input().split()))
	out = solve(num, l)
	results.append(out)
for j in results:
	print(j)


t = int(input())
while t > 0:
	n = int(input())
	li = input().split()
	for i in range(n):
		li[i] = int(li[i])
	n -= 1
	li.sort()
	while n > 0:
		li[n - 1] = (li[n] + li[n - 1]) / 2
		n -= 1
	print(li[0])
	t -= 1


test = int(input())
for i in range(test):
	N = int(input())
	n = input()
	a = list(n.split(' '))
	for k in range(N):
		a[k] = int(a[k])
	a.sort(reverse=True)
	sum = a[0] / 2 ** (N - 1)
	for j in range(1, N):
		sum += a[j] / 2 ** (N - j)
	print(sum)


t = int(input())
for _ in range(0, t):
	n = int(input())
	x = sorted(list(map(int, input().split())))
	for i in range(n - 1, 0, -1):
		x[i - 1] = (x[i] + x[i - 1]) / 2
	print(x[0])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while len(a) != 1:
		a1 = a.pop()
		a2 = a.pop()
		a.append((a1 + a2) / 2)
	ans = a[0]
	print(ans)


tests = int(input())
for i in range(tests):
	length = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = arr[-1]
	for j in range(length - 1, -1, -1):
		ans = (ans + arr[j]) / 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort(reverse=True)
	c = l[0] + l[1]
	for i in range(2, n):
		c += l[i] * 2 ** (i - 1)
	c /= 2 ** (n - 1)
	print(format(c, '.8f'))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	cnt = arr[-1]
	for i in range(1, n):
		cnt = (cnt + arr[-i - 1]) / 2
	print(cnt)


t = int(input())
for _ in range(t):
	N = int(input())
	a = [int(x) for x in input().split()]
	l = sorted(a, reverse=True)
	x = l[0]
	for i in range(1, N):
		x = (x + l[i]) / 2
	print(str.format('{0:.8f}', x))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort(reverse=True)
	avg = (a[0] + a[1]) / 2
	for i in range(2, n):
		avg = (avg + a[i]) / 2
	print(float(avg))


testcase = int(input())
for z in range(testcase):
	N = int(input())
	arr = [int(d) for d in input().split()]
	while N > 2:
		arr = sorted(arr)
		last_two_average = (arr[-1] + arr[-2]) / 2
		arr = arr[:-2]
		arr.append(last_two_average)
		N = N - 1
	print('{0:.8f}'.format((arr[0] + arr[1]) / 2))


for i in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	p.sort()
	o = 0
	p.reverse()
	for i in range(len(p) - 1):
		o = (p[i] + p[i + 1] + o) * 0.5
		p[i + 1] = 0
	print('{0:.8f}'.format(o))


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	s = 0
	s = (l[0] + l[1]) / 2
	for i in range(2, n):
		s = (s + l[i]) / 2
	print(s)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a, reverse=True)
	c = a[0]
	for i in range(1, n):
		c = (c + a[i]) / 2
	print(c)


import sys
import math

def main(arr):
	arr.sort(reverse=True)
	for i in range(1, len(arr)):
		arr[i] = 0.5 * (arr[i] + arr[i - 1])
		arr[i - 1] = 0
	return arr[-1]
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(main(arr))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	while len(a) != 1:
		t = a[-1]
		a.pop()
		l = a[-1]
		a.pop()
		a.append((t + l) / 2)
	print('%.6f' % a[0])


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort(reverse=True)
	for i in range(n - 1):
		c = a.pop(0) + a.pop(0)
		a.insert(0, c / 2)
	print(f'{a[0]:.8f}')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort(reverse=True)
	ans = arr[0]
	for i in range(1, n):
		ans = (ans + arr[i]) / 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	k = (a[0] + a[1]) / 2
	for i in range(2, n):
		k = (k + a[i]) / 2
	print(k)


for i in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A = sorted(A)
	A = A[::-1]
	x = (A[0] + A[1]) / 2
	if len(A) > 2:
		for i in range(2, len(A)):
			x = (A[i] + x) / 2
	print('%.6f' % x)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	arr.reverse()
	su = arr[0]
	for i in range(1, n):
		su = (su + arr[i]) / 2
	print('%.8f' % su)


def Average(A, B):
	return (A + B) / 2
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort(reverse=True)
	while len(A) != 1:
		A.insert(0, Average(A.pop(0), A.pop(0)))
	print(A[0])


ns = lambda : input()
ni = lambda : int(input())
nm = lambda : map(int, input().split())
nl = lambda : list(map(int, input().split()))
for _ in range(ni()):
	n = ni()
	a = nl()
	a.sort()
	ans = a[-1]
	for i in range(1, n):
		ans = (ans + a[n - 1 - i]) / 2
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	s = (l[0] + l[1]) / 2
	for i in range(2, n):
		s = (s + l[i]) / 2
	print(format(s, '.6f'))


for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	ans = nums[n - 1]
	for i in range(2, n + 1):
		ans += nums[n - i]
		ans /= 2
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort(reverse=True)
	sum = (a[0] + a[1]) / 2
	for i in range(2, n):
		sum = (sum + a[i]) / 2
	print(sum)


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = a[-1]
	for i in range(len(a) - 1):
		ans = (ans + a[len(a) - i - 2]) / 2
	zero = '0' * 7
	print(str(ans) + zero)


def poison(n, concentration):
	concentration = sorted(concentration)
	for i in range(n - 1, 0, -1):
		replaced = (concentration[i] + concentration[i - 1]) / 2
		concentration.pop()
		concentration.pop()
		concentration.append(replaced)
	return concentration[0]
t = int(input())
for i in range(t):
	n = int(input())
	concentration = [int(x) for x in input().split()]
	ans = poison(n, concentration)
	print('%.6f' % ans)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	a.reverse()
	c = (a[0] + a[1]) / 2
	for i in range(2, n):
		c = c / 2 + a[i] / 2
	print(c)


for _ in range(int(input())):
	flasks = int(input())
	concentration = sorted(list(map(int, input().split())))
	concentration.reverse()
	newflask = (concentration[0] + concentration[1]) / 2
	for i in range(2, len(concentration)):
		newflask = newflask / 2 + concentration[i] / 2
	print(newflask)


for i in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	k = n - 1
	m = l[n - 1]
	for j in range(n - 1):
		m = (m + l[k - 1]) / 2
		k = k - 1
	print(m)


for _ in range(int(input())):
	b = int(input())
	inp = list(map(int, input().split()))
	l = sorted(inp, reverse=True)
	x = (l[0] + l[1]) / 2
	for i in range(2, b):
		y = l[i]
		x = (x + y) / 2
	x = format(x, '.8f')
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l, reverse=True)
	for j in range(len(l) - 1):
		a = l[j] / 2 + l[j + 1] / 2
		l[j + 1] = a
	print('{0:.8f}'.format(a))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	sl = sorted(l, reverse=True)
	a = sl[0]
	for i in range(1, n):
		a = (a + sl[i]) / 2
	print(a)


def average(a, b):
	return (a + b) / 2
testCases = int(input())
for _ in range(testCases):
	n = int(input())
	concentration = list(map(int, input().split()))
	concentration.sort(reverse=True)
	while len(concentration) > 1:
		concentration.insert(0, average(concentration.pop(0), concentration.pop(0)))
	print(concentration[0])


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(float, input().split()))
	l.sort()
	for i in range(len(l) - 1):
		l[-2] = (l[-2] + l[-1]) / 2
		l.pop()
	print('{0:.8f}'.format(l[0]))


T = int(input())

def algo():
	N = int(input())
	A = list(map(float, input().split()))
	A.sort(reverse=True)
	out = A[0]
	for i in A:
		out = (out + i) / 2
	print(out)
for i in range(T):
	algo()


t = int(input())
for i in range(0, t):
	n = int(input())
	c = list(map(int, input().split()))
	c.sort(reverse=True)
	sum1 = c[0]
	flag = 1
	if n == 1:
		print(c[0])
		flag = 0
	if flag == 1:
		for i in range(1, n):
			sum1 = (sum1 + c[i]) / 2
	print(str.format('{0:.8f}', sum1))


def qsort(arr):
	less = []
	equal = []
	great = []
	if len(arr) > 1:
		pivot = arr[0]
		for i in arr:
			if i < pivot:
				less.append(i)
			elif i == pivot:
				equal.append(i)
			elif i > pivot:
				great.append(i)
		return qsort(great) + equal + qsort(less)
	else:
		return arr
tst = int(input())
while tst > 0:
	tst = tst - 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a = qsort(a)
	l = len(a)
	mean = a[0]
	i = 1
	while i < l:
		mean = mean + a[i]
		mean = mean / 2
		i = i + 1
	print(format(mean, '0.6f'))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(len(l) - 1, 0, -1):
		c = (l[j] + l[j - 1]) / 2
		l[j - 1] = c
	print('{:.8f}'.format(l[0]))


for _ in range(int(input())):
	n = int(input())
	n_list = sorted(list(map(int, input().split())))
	n_list.reverse()
	concentration = (n_list[0] + n_list[1]) / 2
	for i in range(2, len(n_list)):
		concentration = concentration / 2 + n_list[i] / 2
	print(concentration)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	val = arr[0]
	for i in arr[1:]:
		val = (val + i) / 2
	print(val)


t = int(input())
for i in range(t):
	n = input()
	arr = [int(i) for i in input().split()]
	arr.sort()
	while len(arr) != 1:
		w = arr[-1]
		arr.pop()
		e = arr[-1]
		arr.pop()
		arr.append((w + e) / 2)
	print('%.6f' % arr[0])


for M in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if x == 1:
		print(*a)
		continue
	avg = (a[-1] + a[-2]) / 2
	for i in reversed(range(x - 2)):
		avg = (avg + a[i]) / 2
	print(avg)


k = int(input())
for _ in range(k):
	n = input()
	arr = [int(x) for x in input().split(' ')]
	arr.sort()
	arr = arr[::-1]
	init = arr[0]
	for y in range(1, len(arr)):
		init = (init + arr[y]) / 2
	print('%.8f' % init)


T = int(input())
for _ in range(0, T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	while len(a) > 1:
		a[0] = (a[0] + a[1]) / 2
		a.remove(a[1])
	print(a[0])


t = int(input())
for i in range(t):
	n = int(input())
	N = list(map(int, input().split()))
	N.sort()
	k = n - 1
	ave = N[k]
	for j in range(n - 1):
		ave = (ave + N[k - 1]) / 2
		k = k - 1
	print(ave)


t = int(input())
for i in range(t):
	n = int(input())
	conc = sorted(list(map(float, input().split())), reverse=True)
	index = 0
	while n > 1:
		mix_conc = (conc[index] + conc[index + 1]) / 2
		conc.pop(index)
		conc.pop(index)
		conc.append(mix_conc)
		conc = sorted(conc, reverse=True)
		n -= 1
	print('{:.8f}'.format(conc[0]))


try:
	t = int(input())
	for i in range(t):
		l = int(input())
		a = [int(i) for i in input().split()]
		a.sort()
		if len(a) > 2:
			for i in range(l - 1):
				p = len(a)
				d = (a[p - 2] + a[p - 1]) / 2
				del a[p - 2]
				del a[p - 2]
				a.append(d)
			print(a[0])
		else:
			t = sum(a)
			avg = t / len(a)
			print(avg)
except EOFError:
	pass


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	if n == 1:
		print(a[0] / 2)
	else:
		avg = (a[-1] + a[-2]) / 2
		j = n - 3
		while j >= 0:
			avg = (a[j] + avg) / 2
			j -= 1
		print(avg)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	while len(l) != 1:
		l.sort(reverse=True)
		x = l[0] / 2 + l[1] / 2
		l.remove(l[1])
		l.remove(l[0])
		l.append(x)
	print(round(l[0], 6))


for _ in range(int(input())):
	n = int(input())
	l = list(sorted(map(int, input().split()), reverse=True))
	s = l[0]
	for i in range(1, n):
		s = (s + l[i]) / 2
	print(s)


for x in range(int(input())):
	n = int(input())
	a = [int(d) for d in input().split()]
	a.sort(reverse=True)
	i = 0
	while i < len(a) - 1:
		d = (a[i] + a[i + 1]) / 2
		a[i + 1] = d
		data = a[i + 1]
		i += 1
	print(str.format('{0:.8f}', data))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	res = 0
	while len(l) > 1:
		n = len(l)
		res = (l[n - 1] + l[n - 2]) / 2
		l.pop()
		l.pop()
		l.append(res)
	print(l[0])


for tc in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	c = (A[n - 1] + A[n - 2]) / 2
	for i in range(n - 2):
		c = (c + A[n - 3 - i]) / 2
	print(format(c, '.8f'))


for t in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	for i in range(n - 1):
		lis.sort()
		a = lis.pop(len(lis) - 1)
		b = lis.pop(len(lis) - 1)
		lis.append((a + b) / 2)
	print(lis[0])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	poison = (a[-1] + a[-2]) / 2
	for i in range(n - 3, -1, -1):
		poison = (poison + a[i]) / 2
	print(poison)


for t in range(int(input())):
	n = int(input())
	arr = [int(char) for char in input().split()]
	arr.sort()
	for i in range(n - 1):
		l = (arr[-1] + arr[-2]) / 2
		arr.pop()
		arr.pop()
		arr.append(l)
	print(arr[0])


def merge(A, B):
	(C, i, j) = ([], 0, 0)
	while len(C) < len(A) + len(B):
		if A[i] < B[j]:
			C.append(A[i])
			i += 1
			if i == len(A):
				C.extend(B[j:])
		else:
			C.append(B[j])
			j += 1
			if j == len(B):
				C.extend(A[i:])
	return C

def mergesort(L):
	n = len(L)
	if n <= 1:
		return L
	A = mergesort(L[:n // 2])
	B = mergesort(L[n // 2:])
	C = merge(A, B)
	return C
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	L = mergesort(l)
	s = L[-1]
	for k in range(n - 2, -1, -1):
		s += L[k]
		s = s / 2
	print(s)


a = int(input())
for i in range(a):
	c = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	for i in range(c - 1):
		arr[1] = (arr[0] + arr[1]) / 2
		arr.pop(0)
	print(arr[0])


def output(n, arr):
	arr.sort(reverse=True)
	poison = arr[0]
	for i in range(1, n):
		poison = poison / 2 + arr[i] / 2
	print('{:.8f}'.format(poison))
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	output(n, arr)


a = int(input())
for i in range(a):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	for j in range(0, len(l) - 1):
		s = l[j] / 2 + l[j + 1] / 2
		l[j + 1] = s
	print(float(s))


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for j in range(n - 1, 0, -1):
		arr[j - 1] = (arr[j] + arr[j - 1]) / 2
	print(arr[0])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for _ in range(n - 1):
		avg = (a[-1] + a[-2]) / 2
		a = a[:-2]
		a.append(avg)
	print('{0:.8f}'.format(avg))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = l[n - 1] + l[n - 2]
	s = s / 2
	for i in range(n - 3, -1, -1):
		s = s + l[i]
		s = s / 2
	print(s)


t = int(input())
while t:
	t -= 1
	n = int(input())
	num1 = list(map(int, input().split(' ')))
	num1.sort(reverse=True)
	val = num1[0]
	for i in range(1, len(num1)):
		val = (val + num1[i]) / 2
		val = round(val, 9)
	print(val)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = a[n - 1]
	for i in range(n - 1, 0, -1):
		s = (s + a[i - 1]) / 2
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	cities = list(map(int, input().split()))
	cities.sort(reverse=True)
	s = cities[0]
	for i in range(1, n):
		s = (s + cities[i]) / 2
	print('{:.8f}'.format(s))


for _ in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	while len(a) > 1:
		(x, y) = (a.pop(), a.pop())
		a.append((x + y) / 2)
	print('{:.8f}'.format(a[0]))


t = int(input())

def getHalf(a, b):
	x = a / 2
	y = b / 2
	return x + y
for _ in range(t):
	n = int(input())
	n_list = list(sorted(map(int, input().split()), reverse=True))
	value = n_list[0]
	for i in range(n - 1):
		value = getHalf(value, n_list[i + 1])
	print(value)


t = input()
for c in range(0, int(t)):
	n = input()
	a = input().split()
	arr = []
	for x in a:
		arr.append(int(x))
	arr.sort()
	out = 0
	for y in range(int(n) - 1, -1, -1):
		if y < int(n) - 1:
			arr[y] = (arr[y] + arr[y + 1]) / 2
	print(arr[0])


n = int(input())
for i in range(n):
	N = int(input())
	fla = list(map(int, input().split(' ')))
	fla.sort()
	for j in range(N - 1):
		a = fla.pop()
		b = fla.pop()
		fla.append((a + b) / 2)
	print('%.8f' % fla.pop())


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = a[::-1]
	sum = 0
	for i in range(n):
		sum += b[i]
		if i >= 1:
			sum = sum / 2
	print(sum)


t = int(input())
for _ in range(t):
	n = int(input())
	concs = list(map(int, input().split()))
	avg = 0
	avg = float(avg)
	concs = sorted(concs)
	concs = concs[::-1]
	avg = (concs[0] + concs[1]) / 2
	for i in range(n - 2):
		avg = (concs[i + 2] + avg) / 2
	print(avg)


for _ in range(int(input())):
	n = int(input())
	st = input().split()
	A = []
	for x in st:
		A.append(int(x))
	A.sort()
	d = 1.0
	r = 0
	for k in range(n - 1):
		d = 2 * d
		r += A[k] / d
	r += A[n - 1] / d
	print(r)


t = int(input())
while t > 0:
	n = int(input())
	ar = [int(i) for i in input().split()]
	while len(ar) != 1:
		ar.sort(reverse=True)
		a = ar.pop(0)
		b = ar.pop(0)
		c = (a + b) / 2
		ar.append(c)
	a = '%.6f' % ar[0]
	print(a)
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = l[-1]
	for i in range(n - 2, -1, -1):
		ans = (ans + l[i]) / 2
	print('%.8f' % ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	ans = l[0]
	for i in range(1, n):
		ans = (ans + l[i]) / 2
	print(ans)