#include<bits/stdc++.h>
using namespace std;
struct a{
double b[21];
}c[101];
int main(){
int n,m,x;
double he=0;
cin>>n>>m;
for(int i=1;i<=n;i++){
int d=0;
for(int j=1;j<=m;j++){
cin>>c[i].b[j];
d+=c[i].b[j];
}sort(c[i].b+1,c[i].b+1+m);
d=(d-c[i].b[1]-c[i].b[m])/(m-2);
if(d>he)he=d;
}printf("%.2lf",he);
return 0;
}