#include using namespace std; using ld=long double; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--){ int n,m; cin >> n >> m; vector> a(n,vector(m,0)); for(auto &nx : a){ for(auto &ny : nx){cin >> ny;} } int x=0,y=0; ld p=0,q=0; for(int tr=0;tr<10000000;tr++){ for(int i=0;ia[x][j]){y=j;} } p+=a[x][y]; q+=2.0; } cout << fixed << setprecision(20) << (p/q) << "\n"; } return 0; }