#include<bits/stdc++.h>
using namespace std;
int n,m;
double maxn=-1,sum=0,a[10005];;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[j];
sum+=a[j];
}
sort(a+1,a+1+m);
sum=sum-a[1]-a[m];
sum/=(m-2);
maxn=max(sum,maxn);
}
printf("%.2lf",maxn);
return 0;
}