#include <bits/stdc++.h>
using namespace std;
long long Board[2005][2005], D[2005][2005][2];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      scanf("%I64d", &Board[i][j]);
    }
  }
  for (int i = 0; i < n; ++i) {
    int j = 0;
    long long s = 0;
    while (i + j < n) {
      s += Board[i + j][j];
      j++;
    }
    j = 0;
    while (i + j < n) {
      D[i + j][j][0] = s;
      j++;
    }
  }
  for (int i = 0; i < n; ++i) {
    int j = n - 1;
    long long s = 0;
    while (i + (n - 1 - j) < n) {
      s += Board[i + (n - 1 - j)][j];
      j--;
    }
    j = n - 1;
    while (i + (n - 1 - j) < n) {
      D[i + (n - 1 - j)][j][1] = s;
      j--;
    }
  }
  for (int j = 1; j < n; ++j) {
    int i = 0;
    long long s = 0;
    while (i + j < n) {
      s += Board[i][i + j];
      i++;
    }
    i = 0;
    while (i + j < n) {
      D[i][i + j][0] = s;
      i++;
    }
  }
  for (int j = 0; j < n - 1; ++j) {
    int i = 0;
    long long s = 0;
    while (j - i >= 0) {
      s += Board[i][j - i];
      i++;
    }
    i = 0;
    while (j - i >= 0) {
      D[i][j - i][1] = s;
      i++;
    }
  }
  long long bestv[2] = {0, 0};
  int pos[2][2] = {{1, 1}, {1, 2}};
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      int k = (i + j) % 2;
      long long t = D[i][j][0] + D[i][j][1] - Board[i][j];
      if (bestv[k] < t) {
        bestv[k] = t;
        pos[k][0] = i + 1, pos[k][1] = j + 1;
      }
    }
  }
  cout << bestv[0] + bestv[1] << "\n";
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      cout << pos[i][j] << " ";
    }
  }
  cout << "\n";
}
