#include <bits/stdc++.h>
using namespace std;
long long a[3000][3000];
long long fl[3000][3000];
long long fr[3000][3000];
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%I64d", &a[i][j]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) fl[i][j] = fl[i - 1][j - 1] + a[i][j];
  for (i = n - 1; i >= 1; i--)
    for (j = n - 1; j >= 1; j--) fl[i][j] = fl[i + 1][j + 1];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) fr[i][j] = fr[i - 1][j + 1] + a[i][j];
  for (i = n - 1; i >= 1; i--)
    for (j = n; j >= 2; j--) fr[i][j] = fr[i + 1][j - 1];
  long long maxx = 0, maxi, maxj, minn = 0, mini, minj;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if ((i + j) % 2 == 0) {
        if (maxx <= fl[i][j] + fr[i][j] - a[i][j]) {
          maxx = fl[i][j] + fr[i][j] - a[i][j];
          maxi = i;
          maxj = j;
        }
      } else {
        if (minn <= fl[i][j] + fr[i][j] - a[i][j]) {
          minn = fl[i][j] + fr[i][j] - a[i][j];
          mini = i;
          minj = j;
        }
      }
    }
  }
  printf("%I64d\n", maxx + minn);
  printf("%I64d %I64d %I64d %I64d\n", maxi, maxj, mini, minj);
  return 0;
}
