#include<iostream>
#include<string>
#include <iomanip>
using namespace std;
int main(){
int n, m;
int temp;
char ch[101];
string s;
cin>>n;
double count_line;
double count_case;
for(int i = 0; i < n; i++){//处理每个case
count_case = 0;
cin>>m;
for(int j = 0; j < m; j++){//处理case中的每一行
count_line = 0;
cin>>s;
strcpy(ch, s.c_str());
for(int k = 0; ch[k] != '\0'; k++){//处理每一行中的每个字符
if(ch[k] == '-'){
continue;
}else{
if(ch[k+1] == '-' || ch[k+1] == '\0'){
temp = ch[k] - 48;
count_line += temp;
}else{
temp = (ch[k] - 48) * 10 + (ch[k + 1] - 48);
count_line += temp;
k++;
}
}
}
if(j == 0){
count_case = count_line;
}else{
count_case = (count_case * count_line) / (count_case + count_line);
}
}
cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixed
cout.precision(2);
cout<<count_case<<endl;
}
}