#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int ball_num,rank[10];
double circu[10],ans,temp;
double data[10][3];
bool flag[10];
// 1 is x, 2 is y and circu;
double calcula(double r1,double r2){
return sqrt(pow(r1+r2,2)-pow(r1-r2,2));
}
void dps(int n){
double x=0,y=0,temp1,temp2;
// if okay
if(n==ball_num){
double left_most=99999999,right_most=-99999999;
for(int i=0;i<ball_num;i++){
temp1 = data[i][1]-data[i][2];
temp2 = data[i][1]+data[i][2];
if(temp1<left_most){left_most = temp1;}
if(temp2>right_most){right_most = temp2;}
}
if(right_most-left_most<ans){ans = right_most-left_most;}
//cout<<"find one "<<endl;
/*
for(int i =0;i<ball_num;i++){
cout<<data[i][1]<<" "<<data[i][2]<<endl;
}
*/
return;
}
for(int i = 1;i<=ball_num;i++){
if(flag[i]==0){
if(n ==0){
x = y = circu[i];
}
else{
double max_x=0,temp_num;
for(int j = 0;j<n;j++){
temp_num = data[j][1];
//data[j][2] + circu[i]
temp_num+=calcula(data[j][2],circu[i]);
if(temp_num>max_x){max_x = temp_num;}
}
x = max_x;
}
y = circu[i];
data[n][1] = x; data[n][2] = y;
flag[i] = 1;
dps(n+1);
flag [i] = 0;
}
}
}
int main() {
//ifstream cin("ha.txt");
int t;
cin>>t;
while(t--){
cin>>ball_num;
for(int i=1;i<=ball_num;i++){
cin>>circu[i];
}
ans = 999999999;
memset(flag,0,sizeof(flag));
dps(0);
printf("%.3lf\n",ans);
}
}