#include <bits/stdc++.h>
using namespace std;
long long int p[2003][2003], r[2003][2003], l[2003][2003];
int n, rgenap, cgenap, rganjil, cganjil;
long long int calc(int col, int row) {
  int mini;
  mini = min(n - col, n - row);
  long long int a = r[col + mini][row + mini];
  mini = min(col - 1, n - row);
  long long int b = l[col - mini][row + mini];
  return a + b - p[col][row];
}
int main(void) {
  scanf("%d", &n);
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) scanf("%I64d", &p[i][j]);
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) r[i][j] = p[i][j] + r[i - 1][j - 1];
  for (int j = 1; j <= n; j++)
    for (int i = n; i >= 1; i--) l[i][j] = p[i][j] + l[i + 1][j - 1];
  rgenap = cgenap = 1;
  rganjil = 1;
  cganjil = 2;
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) {
      if ((i + j) % 2 == 1) {
        if (calc(i, j) > calc(cganjil, rganjil)) {
          cganjil = i;
          rganjil = j;
        }
      } else {
        if (calc(i, j) > calc(cgenap, rgenap)) {
          cgenap = i;
          rgenap = j;
        }
      }
    }
  printf("%I64d\n", calc(cganjil, rganjil) + calc(cgenap, rgenap));
  printf("%d %d %d %d\n", rganjil, cganjil, rgenap, cgenap);
}
