#include <bits/stdc++.h>
using namespace std;
const int NMax = 2000 + 10;
int N;
long long a[NMax][NMax];
long long prinDiag[5 * NMax], secDiag[5 * NMax];
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      cin >> a[i][j];
      int index1 = NMax + i - j, index2 = NMax + i + j;
      prinDiag[index1] += a[i][j];
      secDiag[index2] += a[i][j];
    }
  }
  long long max1, x1, y1, max2, x2, y2, val;
  max1 = max2 = -1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      int index1 = NMax + i - j, index2 = NMax + i + j;
      val = prinDiag[index1] + secDiag[index2] - a[i][j];
      if ((i + j) % 2 == 0 && max1 < val) {
        max1 = val;
        x1 = i;
        y1 = j;
      } else if ((i + j) % 2 == 1 && max2 < val) {
        max2 = val;
        x2 = i;
        y2 = j;
      }
    }
  }
  cout << max1 + max2 << '\n' << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2;
  return 0;
}
