#include <bits/stdc++.h>
using namespace std;
const int max_n = 2000;
long long int n;
long long int mas[max_n][max_n] = {}, d[2][max_n * 2 - 1] = {};
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%d", &mas[i][j]);
      d[0][i + j] += mas[i][j];
      d[1][i + (n - 1) - j] += mas[i][j];
    }
  int maxpi[2], maxpj[2];
  long long int maxs[2] = {-1, -1};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      long long int sum = d[0][i + j] + d[1][i + (n - 1) - j] - mas[i][j];
      int odd = (i + j) % 2;
      if (sum > maxs[odd]) {
        maxs[odd] = sum;
        maxpi[odd] = i + 1;
        maxpj[odd] = j + 1;
      }
    }
  cout << maxs[0] + maxs[1] << endl;
  cout << maxpi[0] << ' ' << maxpj[0] << ' ';
  cout << maxpi[1] << ' ' << maxpj[1];
}
