#include <bits/stdc++.h>
using namespace std;
const int NMAX = 2014;
long long int diag1[2 * NMAX], diag2[2 * NMAX];
long long int a[NMAX][NMAX];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long int x1, y1, x2, y2;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
      diag1[i + j] += a[i][j];
      diag2[n + i - j] += a[i][j];
    }
  }
  long long int sol[2] = {-1, -1};
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (diag1[i + j] + diag2[i - j + n] - a[i][j] > sol[(i + j) & 1]) {
        sol[(i + j) & 1] = diag1[i + j] + diag2[i - j + n] - a[i][j];
        if ((i + j) % 2 == 0) {
          x1 = i;
          y1 = j;
        } else {
          x2 = i;
          y2 = j;
        }
      }
    }
  }
  cout << sol[0] + sol[1] << "\n";
  if (x1 < x2) {
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " ";
  } else {
    cout << x2 << " " << y2 << " " << x1 << " " << y1 << "\n";
  }
  return 0;
}
