/******************************************
*(圆排列问题) 用center计算圆心因为圆与前面的圆相切,但不一定是它的前一个
*/
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
using namespace std;
const int N = 10;
double r[N], x[N];
int m;
double ans = INT_MAX;
void BackTrace(int t);
double center(int t);
void compute();
int main()
{
int n;
#ifndef ONLINE_JUDGE
freopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endif
scanf("%d", &n);
while (n--) {
scanf("%d", &m);
ans = INT_MAX;
for (int i = 0; i < m; i++)
scanf("%lf", &r[i]);
BackTrace(0);
printf("%.3lf\n", ans);
}
return 0;
}
void BackTrace(int t)
{
if (t >= m) compute();
else {
for (int i = t; i < m; i++) {
swap(r[t], r[i]);
double centerx = center(t);
if (centerx + r[0] + r[t] < ans) {
x[t] = centerx;
BackTrace(t + 1);
}
swap(r[t], r[i]);
}
}
}
double center(int t)
{
double temp = 0;
for (int i = 0; i < t; i++) {
double value = x[i] + 2 * sqrt(r[t] * r[i]);
if (value > temp) temp = value;
}
return temp;
}
void compute()
{
double high = 0, low = 0;
for (int i = 0; i < m; i++) {
if (x[i] - r[i] < low) low = x[i] - r[i];
if (x[i] + r[i] > high) high = x[i] + r[i];
}
if (high - low < ans) ans = high - low;
}