#include <bits/stdc++.h>
using namespace std;
long long a1[2001][2001], a2[2001][2001], summ;
long long a[2001][2001], n, ans1 = -1, ans2 = -1, i1, i2, jj, j2;
int t;
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%lld", &a[i][j]);
  for (int i = 0; i < n; i++) {
    t = i;
    summ = 0;
    for (int j = 0; max(j, t) < n; j++, t++) summ += a[t][j];
    t = i;
    for (int j = 0; max(j, t) < n; j++, t++) a1[t][j] = summ;
    summ = 0;
    t = i;
    for (int j = 0; max(j, t) < n; j++, t++) summ += a[j][t];
    t = i;
    for (int j = 0; max(j, t) < n; j++, t++) a1[j][t] = summ;
  }
  for (int i = 0; i < n; i++) {
    t = i;
    summ = 0;
    for (int j = 0; j < n && t > -1; j++, t--) summ += a[t][j];
    t = i;
    for (int j = 0; j < n && t > -1; j++, t--) a2[t][j] = summ;
    summ = 0;
    t = i;
    for (int j = 0; j < n && t > -1; j++, t--) summ += a[n - j - 1][n - t - 1];
    t = i;
    for (int j = 0; j < n && t > -1; j++, t--) a2[n - j - 1][n - t - 1] = summ;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if ((i + j) % 2 == 0) {
        if (ans1 < a1[i][j] + a2[i][j] - a[i][j])
          ans1 = a1[i][j] + a2[i][j] - a[i][j], i1 = i + 1, jj = j + 1;
      } else {
        if (ans2 < a1[i][j] + a2[i][j] - a[i][j])
          ans2 = a1[i][j] + a2[i][j] - a[i][j], i2 = i + 1, j2 = j + 1;
      }
  cout << ans1 + ans2 << endl
       << i1 << " " << jj << " " << i2 << " " << j2 << endl;
}
