JJ loves playing with averages. He has an array A of length N. He wants to divide the array A into two non-empty subsets P and Q such that the value of mean(P) + mean(Q) is as large as possible. (Note that each A_{i} must belong to either subset P or subset Q).

Help him find this maximum value of mean(P) + mean(Q).

As a reminder, the mean of a subset X of size M is defined as: mean(X) = \dfrac{\sum_{i = 1}^{M} X_{i}}{M}. 

For example, mean([3, 1, 4, 5]) = \frac{3 + 1 + 4 + 5}{4} = 3.25.

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

- The first line contains T - the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer N - the size of the array A.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \dots, A_{N} denoting the array A.

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

Output the largest value of mean(P) + mean(Q).

Your answer is considered correct if its absolute or relative error does not exceed 10^{-6}.

Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if \frac{|a - b|}{\max{(1, |b|)}} ≤ 10^{-6}.

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

$1 ≤ T ≤ 100$
$2 ≤ N ≤ 1000$
$1 ≤ A_{i} ≤ 10^{6}$

----- Sample Input 1 ------ 
2
2
4 5
5
2 2 2 2 2

----- Sample Output 1 ------ 
9.000000
4.000000

----- explanation 1 ------ 
*Test case-1:* We can divide the two elements into two non-empty subsets $P$ and $Q$ as follows: $P = [4]$, $Q = [5]$. 

Therefore, $mean(P) + mean(Q) = 9$.

*Test case-2:* In whatever way we divide the elements of the array, mean of both the subsets will always be $2$.

Therefore, $mean(P) + mean(Q) = 4$.

Difficulty: MEDIUM

Starter code:

Solutions:
case = int(input())
for _ in range(case):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	value = max(arr)
	res = value + (sum(arr) - value) / (n - 1)
	print(res)


for _ in range(int(input())):
	n = int(input())
	list1 = [int(x) for x in input().split()]
	list1.sort()
	print(sum(list1[:n - 1]) / (n - 1) + list1[n - 1])


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


o = 'bool'
f = 0
for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	sum = 0
	h = 1234
	for i in range(n - 1):
		sum += s[i]
	sum = sum / (n - 1)
	sum += s[-1]
	print(sum)


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


import os, sys, io, math
from re import *
from math import *
from array import *
from heapq import *
from bisect import *
from functools import *
from itertools import *
from statistics import *
from collections import *
I = lambda : [*map(int, sys.stdin.readline().split())]
IP = lambda : map(int, input().split())
IS = lambda : input()
IN = lambda : int(input())
IF = lambda : float(input())

def f():
	(n, l) = (IN(), I())
	m = max(l)
	s = sum(l)
	return m + (s - m) / (n - 1)
for _ in range(IN()):
	print(f())


testcase = int(input())

def meanmax(arr):
	max_ele = max(arr)
	ans = max_ele + (sum(arr) - max_ele) / (len(arr) - 1)
	return ans
while testcase:
	size = input()
	arr = input()
	arr = [int(num) for num in arr.split(' ')]
	print(meanmax(arr))
	testcase -= 1


t = int(input())
while t != 0:
	n = int(input())
	l = list(map(int, input().split()))
	m = max(l)
	l.remove(m)
	s = 0
	for i in l:
		s = s + i
	print('{:.6f}'.format(m + s / (n - 1)))
	t = t - 1


def mean_Array(a):
	return sum(a) / len(a)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(mean_Array(a[0:len(a) - 1]) + a[-1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = a[0]
	r = sum(a[1:])
	m = l + r / (n - 1)
	for i in range(1, n - 1):
		l += a[i]
		r -= a[i]
		m1 = l / (i + 1)
		m2 = r / (n - i - 1)
		m = max(m, m1 + m2)
	print(m)


tests = int(input())
for i in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	maximum = max(arr)
	total = sum(arr)
	print(maximum + (total - maximum) / (n - 1))


from bisect import bisect_left, bisect_right
import math
from sys import maxsize
from collections import defaultdict
from bisect import bisect_left
from heapq import heapify, heappush, heappop
from collections import deque
import sys
from math import gcd, sqrt, log10, log2, floor, ceil, sqrt
from collections import deque, defaultdict
input = sys.stdin.readline

def il():
	return [int(a) for a in input().strip().split()]

def ip():
	return input().strip()

def ii():
	return int(input())

def ot(in_p, *args, e=' '):
	if type(in_p) == list:
		print(*in_p, end=e)
	if type(in_p) == str or type(in_p) == int:
		print(in_p, end=e)
		for l in args:
			print(l, end=e)
	print()

def a_pwr_n(a, n, mod):
	if n == 1:
		return a % mod
	if n % 2 == 0:
		val = a_pwr_n(a, n // 2, mod)
		return val % mod * val % mod
	else:
		return a % mod * a_pwr_n(a, n - 1, mod) % mod

def rg(*ag):
	if len(ag) == 3:
		return range(ag[0], ag[1], ag[2])
	elif len(ag) == 2:
		return range(ag[0], ag[1])
	elif len(ag) == 1:
		return range(ag[0])
	else:
		raise 'invalid input'

def ispal(i, j, st):
	while i <= j:
		if st[i] == st[j]:
			i = i + 1
			j = j - 1
		else:
			return False
	return True
mod = 1000000000 + 7
dx = [-1, -2, 1, 2, 2, -2, -1, 1]
dy = [2, 1, 2, 1, -1, -1, -2, -2]
for z in range(ii()):
	lim = ii()
	temp = il()
	print((sum(temp) - max(temp)) / (lim - 1) + max(temp))


def soln(n, arr):
	maxm = max(arr)
	m_sum = sum(arr) - maxm
	return maxm + m_sum / (n - 1)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(f'{soln(n, arr):.6f}')


for t in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(a[n - 1] + (sum(a) - a[n - 1]) / (n - 1))


for T in range(int(input())):
	n = int(input())
	L = sorted(map(int, input().split()))
	print(L[-1] + sum(L[:-1]) / (n - 1))


for t in range(int(input())):
	a = int(input())
	b = list(map(int, input().strip().split()))
	c = max(b)
	d = (sum(b) - c) / (a - 1)
	print(c + d)


test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().strip().split()))
	mx = max(a)
	su = (sum(a) - mx) / (n - 1)
	print(mx + su)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().lstrip().split()))
	arr.sort()
	ans = 0
	if n == 2:
		ans += sum(arr)
		print('{:.6f}'.format(ans))
	else:
		ans += sum(arr[:n - 1]) / (n - 1) + arr[n - 1]
		print('{:.6f}'.format(ans))


for i in range(int(input())):
	N = int(input())
	l = list(map(int, input().split()))
	p = max(l)
	temp_avg = (sum(l) - p) / (N - 1)
	print(temp_avg + p)


t = int(input())
while t > 0:
	n = int(input())
	array = list(map(int, input().split(' ')[:n]))
	maxele = max(array)
	temp_avg = (sum(array) - maxele) / (n - 1)
	print(temp_avg + maxele)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = max(l)
	y = (sum(l) - k) / (n - 1)
	print(k + y)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	s = (sum(a) - m) / (n - 1)
	print(m + s)


import numpy as np
for i in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	p = [A[n - 1]]
	q = []
	for i in range(n - 1):
		q.append(A[i])
	print(np.mean(p) + np.mean(q))


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = max(x)
	z = []
	s = []
	x.sort()
	print('{:.6f}'.format((sum(x) - x[-1]) / (len(x) - 1) + x[-1]))


n = int(input())
for i in range(n):
	a = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	b = a - 1
	c = int(lst[-1]) + sum(lst[:-1]) / b
	print(c)


for i in range(int(input())):
	x = int(input())
	c = list(map(int, input().split(' ')))[:x]
	c.sort()
	p = []
	for i in range(x):
		if i != x - 1:
			y = c[:i + 1]
			z = c[i + 1:]
			p.append(sum(y) / len(y) + sum(z) / len(z))
	print('{:.6f}'.format(max(p)))


for i in range(int(input())):
	x = int(input())
	c = list(map(int, input().split(' ')))[:x]
	c.sort()
	print('{:.6f}'.format((sum(c) - c[-1]) / (len(c) - 1) + c[-1]))


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	s = sum(arr) - arr[-1]
	av = s / (n - 1)
	av = av + arr[-1]
	print(av)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().strip().split(' '))))
	total = 0
	for x in range(n - 1):
		total += arr[x]
	meanP = total / (n - 1)
	meanQ = float(arr[-1])
	res = meanP + meanQ
	print(res)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	k = sum(l1[:n - 1]) / (n - 1) + l1[n - 1]
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	x = max(num)
	y = (sum(num) - x) / (n - 1)
	print(x + y)


T = int(input())
for _ in range(T):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	print(sum(a[:n - 1]) / (n - 1) + a[-1])


T = int(input())
for t in range(T):
	N = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	sum_min = 0
	sum_max = sum(nums)
	means = []
	for i in range(0, N - 1):
		sum_min += nums[i]
		sum_max -= nums[i]
		mean = sum_min / (i + 1) + sum_max / (N - i - 1)
		means.append(mean)
	print(max(means))


def main():
	tsc = int(input())
	for i in range(0, tsc):
		length = int(input())
		string = input()
		List = []
		string = string.split()
		for word in string:
			List.append(float(word))
		List.sort()
		A = List.pop()
		B = List
		a = A + mean(B)
		print(format(a, '.6f'))

def mean(x):
	sum = 0
	for index in range(0, len(x)):
		sum += x[index]
	lmean = sum / len(x)
	return lmean
main()


for _ in range(int(input())):
	n = int(input())
	k = list(map(int, input().split()))
	k.sort()
	x = max(k) + sum(k[:n - 1]) / (n - 1)
	print('%.6f' % x)


for _ in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	m = max(arr)
	t = sum(arr)
	print(m + (t - m) / (len(arr) - 1))


t = int(input())
for _ in range(t):
	maximum = 0
	n = int(input())
	arr = list(map(int, input().split()))
	print(max(arr) + (sum(arr) - max(arr)) / (n - 1))


t = int(input())
while t > 0:
	t -= 1
	x = int(input())
	lst = list(map(int, input().split()))
	print(max(lst) + (sum(lst) - max(lst)) / (x - 1))


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	s = 0
	m = 0
	k = max(a)
	for i in range(n):
		if a[i] == k:
			if m == 0:
				m = 1
				continue
			else:
				s = s + a[i]
		else:
			s = s + a[i]
	avg = s / (n - 1) + k
	print(avg)
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	ali = list(map(int, input().split()))
	mx = max(ali)
	ind = ali.index(mx)
	del ali[ind]
	if len(ali) > 0:
		mn = mx + sum(ali) / len(ali)
		print(mn)


for T in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	avg = (sum(l) - max(l)) / (n - 1)
	print(max(l) + avg)


T = int(input())
for tc in range(T):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	mean = sum(a[:n - 1]) / (n - 1) + a[-1]
	print(mean)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	max1 = max(arr)
	print(round(max1 + (sum(arr) - max1) / (n - 1), 6))


for _ in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	total = sum(arr)
	pref = [arr[0]]
	for i in range(1, len(arr)):
		pref.append(pref[-1] + arr[i])
	maxMean = -float('inf')
	for i in range(1, len(arr)):
		left = pref[i - 1] / i
		right = (total - pref[i - 1]) / (len(pref) - i)
		maxMean = max(maxMean, left + right)
	print(maxMean)


def mean(p, q):
	a = 0
	b = 0
	for i in p:
		a += i
	for i in q:
		b += i
	return a / len(p) + b / len(q)
for i in range(int(input())):
	N = int(input())
	A = list(map(int, input().split(' ')))
	A.sort()
	c = mean(A[:-1], A[-1:])
	print(c)


n = int(input())
for i in range(n):
	sz = int(input())
	lst = [int(i) for i in input().split()]
	maxI = lst[0]
	sumI = 0
	for i in lst:
		if i > maxI:
			maxI = i
		sumI += i
	print((sumI - maxI) / (sz - 1) + maxI)


T = int(input())
for i in range(T):
	N = int(input())
	lst = list(map(int, input().split()))
	avgp = 0
	avgq = 0
	lst.sort()
	for j in range(len(lst) - 1):
		avgp += lst[j]
	avgq += lst[len(lst) - 1]
	avgp /= N - 1
	print(avgp + avgq)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	k = lst[len(lst) - 1]
	a = (sum(lst) - k) / (len(lst) - 1)
	ans = a + k
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = max(l)
	ind = l.index(m)
	l.pop(ind)
	ans = m + sum(l) / (n - 1)
	print(ans)


def readList():
	li = [int(x) for x in input().split()]
	return li

def ab_janJaooo():
	length = int(input())
	arr = readList()
	p = arr[0]
	for item in arr:
		if p < item:
			p = item
	arr.remove(p)
	sum = 0
	for x in arr:
		sum += x
	sum /= length - 1
	print(p + sum)
t = int(input())
for _ in range(t):
	ab_janJaooo()


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = 0
	for i in range(n - 1):
		s = s + l[i]
	z = s / (n - 1) + l[n - 1]
	print('%0.6f' % z)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(max(l) + (sum(l) - max(l)) / (n - 1))


for _ in range(int(input())):
	N = int(input())
	A = sorted(list(map(int, input().split(' '))))
	S = 0
	for i in range(N - 1):
		S += A[i]
	print('%.6f' % (A[-1] + S / (N - 1)))


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	(sum1, sum2) = (arr[-1], sum(arr) - arr[-1])
	(l1, l2) = (1, len(arr) - 1)
	ans = sum1 / l1 + sum2 / l2
	for i in range(len(arr) - 2, 0, -1):
		sum1 += arr[i]
		sum2 -= arr[i]
		l1 += 1
		l2 -= 1
		total = sum1 / l1 + sum2 / l2
		ans = max(ans, total)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	k = sum(l1[0:n - 1])
	a = k / (n - 1)
	z = a + l1[-1]
	print(z)


t = int(input())
while t:
	n = input()
	n = int(n)
	list = [int(x) for x in input().split()]
	list = sorted(list)
	x = list[n - 1]
	list.remove(list[n - 1])
	mean = float(sum(list) / len(list))
	print('%.6f' % (mean + x))
	t -= 1


def mean(arr):
	l = len(arr)
	mean1 = sum(arr) / l
	return mean1
T = int(input())
for _ in range(T):
	p = []
	N = int(input())
	a = list(map(int, input().split()))
	p.append(max(a))
	a.remove(max(a))
	m1 = mean(p)
	m2 = mean(a)
	print(m1 + m2)


for i in range(int(input())):
	n = int(input())
	l = [int(j) for j in input().split()]
	k = sorted(l)[::-1]
	s = k[0]
	k.remove(s)
	d = s + sum(k) / len(k)
	print('{:.6f}'.format(d))


import math
for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())), reverse=True)
	mw1 = arr[0]
	mw2 = (sum(arr) - mw1) / (n - 1)
	print(mw1 + mw2)


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


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = sum(a[:n - 1]) / (n - 1)
	s += a[n - 1]
	print(s)
	t -= 1


t = int(input())
for i in range(0, t):
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	a = lst[:-1]
	b = lst[-1:]
	print(sum(a) / len(a) + sum(b) / len(b))


def sol(l, n):
	if n < 3:
		return '{0:.6f}'.format(sum(l))
	elif len(set(l)) == 1:
		return '{0:.6f}'.format(sum(l[:2]))
	l.sort()
	s = sum(l[:n - 1]) / (n - 1)
	return '{0:.6f}'.format(s + l[n - 1])
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(sol(l, n))


for q in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))[:n]
	sum1 = sum(arr)
	max1 = max(arr)
	sum2 = (sum1 - max1) / (n - 1)
	ans = sum2 + max1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	t1 = lis[-1]
	t2 = sum(lis[0:n - 1]) / (n - 1)
	su = t1 + t2
	print(su)


t = int(input())
while t != 0:
	n = int(input())
	summ = 0
	lst = list(map(int, input().split(' ')))
	if n == 1:
		print('0.000000')
		break
	lst.sort()
	for j in range(0, n - 1):
		summ += lst[j]
	summ /= n - 1
	summ += lst[n - 1]
	print('{:.6f}'.format(summ))
	print('\n')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=1)
	ans = 0
	for i in range(n):
		try:
			x = l[0:i + 1]
		except IndexError:
			pass
		try:
			y = l[i + 1:]
		except IndexError:
			pass
		try:
			mean = sum(x) / len(x) + sum(y) / len(y)
		except ZeroDivisionError:
			continue
		if mean > ans:
			ans = mean
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(s, m1, m2) = (sum(arr), min(arr), max(arr))
	print(max((s - m1) / (n - 1) + m1, (s - m2) / (n - 1) + m2))


import sys

def input():
	return sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(max(a) + (sum(a) - max(a)) / (len(a) - 1))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mx = s = 0
	for i in l:
		if i > mx:
			mx = i
		s += i
	s -= mx
	print(s / (n - 1) + mx)


import numpy as np
t = int(input())
while t != 0:
	t -= 1
	m = int(input())
	l = list(map(int, input().split()))
	c = sum(l)
	l.sort()
	c = c - l[m - 1]
	c = c / (m - 1)
	print(c + l[m - 1])