#include<stdio.h>
#include<math.h>
int m,n,min,max,i,j,acc,sum,score[20],total_sco=0;
float aver,high_score=0.00;
int main()
{
scanf(" %d %d ", &n, &m);
acc = m - 2;
for( i=0; i<n; i++)
{
sum = 0;
for(j=0; j<m; j++) //算出每个同学的平均分;
{
min=score[0];
max=score[0];
scanf(" %d ", &score[j]);
sum = sum + score[j];
if( score[j] > max)
{
max = score[j];
}
if( score[j] < min)
{
min = score[j];
}
}
total_sco = sum - max - min;
aver = total_sco / acc;
if(aver >high_score)
{
high_score = aver;
}
}
printf("%.2f ",high_score);
}