import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
int[] arr = new int[m];
int score = 0;
double a=0.00,b=0.00;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
arr[j] = scanner.nextInt();
}
Arrays.sort(arr);
for(int j=1;j<arr.length-1;j++) {
score+=arr[j];
}
if(i==0) {
a = (double)score/(m-2);
}else if(i>0) {
b = (double)score/(m-2);
if(a<b) {
a = b;
}
}
score = 0;
}
System.out.printf("%.2f",a);
}
}