import java.util.*;
import java.io.*;

public class max_ia implements Runnable {
	
	private BufferedReader in;
	private PrintWriter out;
	private int INF = 1000000000;
	
	public void run() {
		try {
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}		
	}
	
	private void solve() throws Exception {
		Locale.setDefault(Locale.US); 

		in = new BufferedReader(new FileReader("max.in"));
		out = new PrintWriter("max.out");
		
		StringTokenizer st = new StringTokenizer(in.readLine());
		int m = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());
		
		int[][] a = new int[m + 1][n + 1];
		int[][] s = new int[m + 1][n + 1];
		
		for (int i = 1; i <= m; i++) {
			st = new StringTokenizer(in.readLine());
			for (int j = 1; j <= n; j++) {
				a[i][j] = Integer.parseInt(st.nextToken());
				s[i][j] = s[i][j - 1] + a[i][j];
			}
		}
		
		int best = -INF;
		int bi1 = -1;
		int bi2 = -1;
		int bj1 = -1;
		int bj2 = -1;
		
		int[][] f = new int[n + 1][];
		int[][] p = new int[n + 1][];
		for (int j = 0; j <= n; j++) {
			f[j] = new int[j];
			p[j] = new int[j];
			
			Arrays.fill(f[j], -INF);
		}
		
		for (int i = 1; i <= m; i++) {
			for (int j1 = 2; j1 <= n; j1++) {
				for (int j2 = 1; j2 < j1; j2++) {
					int sh = s[i][j1] - s[i][j2 - 1];
					int cur = f[j1][j2] + sh;
					if (cur > best) {
						best = cur;
						bi1 = p[j1][j2];
						bi2 = i;
						bj1 = j2;
						bj2 = j1;
					}
					
					f[j1][j2] += a[i][j1] + a[i][j2];
					if (f[j1][j2] < sh) {
						f[j1][j2] = sh;
						p[j1][j2] = i;
					}
				}
			}			
		}
		
		out.println(best);
		out.println(bi1 + " " + bj1 + " " + bi2 + " " + bj2);
		
		in.close();
		out.close();		
	}

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

}
