#include <iostream>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int wy[20] = {0},maxn = -1,minn = 11,maxcount = 0;
while(n--){
int count = 0;
for(int i = 0;i<m;i++){
cin >> wy[i];
if(wy[i] > maxn) maxn = wy[i];
if(wy[i] < minn) minn = wy[i];
count += wy[i];
}
count -= maxn + minn;
if(count > maxcount) maxcount = count;
}
double ppy = maxcount/(m-2);
cout << fixed << setprecision(2) << ppy;
return 0;
}