#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[2010][2010];
long long trai[4 * 2010], phai[4 * 2010];
struct arr {
  long long val;
  int x, y;
};
void solve() {
  int i, j, xchan, ychan, xle, yle;
  arr temp;
  long long maxchan, maxle;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      trai[i + j - 1] += a[i][j];
      phai[i + (n - j + 1) - 1] += a[i][j];
    }
  maxchan = -1;
  maxle = -1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      temp.val = trai[i + j - 1] + phai[i + (n - j + 1) - 1] - a[i][j];
      temp.x = i;
      temp.y = j;
      if ((i + j) % 2 == 0) {
        if (temp.val > maxchan) {
          maxchan = temp.val;
          xchan = temp.x;
          ychan = temp.y;
        }
      } else {
        if (temp.val > maxle) {
          maxle = temp.val;
          xle = temp.x;
          yle = temp.y;
        }
      }
    }
  cout << maxchan + maxle << endl;
  cout << xchan << " " << ychan << " " << xle << " " << yle << endl;
}
void input() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%I64d", &a[i][j]);
  solve();
}
int main() {
  input();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
