import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class max_is implements Runnable {
    String filename = max_is.class.getName().substring(0, max_is.class.getName().indexOf('_'));
    
    PrintWriter out;
    BufferedReader in;
    StringTokenizer st;
    File inFile;

    private static int inf = (int)1e8;
    
    max_is() {
    
        try {
            inFile = new File(filename + ".in");
            in = new BufferedReader(new FileReader(inFile));            
            st = new StringTokenizer(in.readLine());
            out = new PrintWriter(new File(filename + ".out"));
        } catch (IOException e) {
            e.printStackTrace();
        }   
    }
    
    String nextToken() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return null;            
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }
    
    int nextInt() throws IOException {
        String t = nextToken();     
        return t == null ? Integer.MIN_VALUE : Integer.parseInt(t);
    }
    
    public void run() {
        try {
            int n = nextInt();
            int m = nextInt();
            assert 2 <= n && n <= 300;
            assert 2 <= m && m <= 300;
            int[][] a = new int[n][m];
            int x1b = 1;
            int y1b = 1;
            int x2b = 1;
            int y2b = 1;
            int r = -inf;           
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[i][j] = nextInt();
                }
            }
            int[][] c = new int[m][m];
            int[][] b = new int[m][m];
            for (int[] c1 : c) {
                Arrays.fill(c1, -inf);
            }
            int[][] d = new int[m][m];
            for (int y = 0; y < n; y++) {
                for (int x1 = 0; x1 < m; x1++) {
                    d[x1][x1] = a[y][x1];
                    for (int x2 = x1 + 1; x2 < m; x2++) {
                        d[x1][x2] = d[x1][x2 - 1] + a[y][x2];
                        if (c[x1][x2] + d[x1][x2] > r) {
                            r = c[x1][x2] + d[x1][x2];
                            x1b = x1;
                            x2b = x2;
                            y1b = b[x1][x2];
                            y2b = y;
                        }
                        c[x1][x2] += a[y][x1] + a[y][x2];
                        if (c[x1][x2] < d[x1][x2]) {
                            c[x1][x2] = d[x1][x2];
                            b[x1][x2] = y;
                        }
                    }
                }
            }           
            out.format("%d\n%d %d %d %d", r, y1b + 1, x1b + 1, y2b + 1, x2b + 1);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(239);
        } finally {
            out.close();
        }       
    }

    public static void main(String[] args) {
        new Thread(new max_is()).start();
    }
    
}
