#include <bits/stdc++.h>
using namespace std;
int long long a[4007], b[4007];
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int long long n;
  cin >> n;
  int long long vv[n + 1][n + 1];
  for (int long long i = 1; i <= n; i++) {
    for (int long long j = 1; j <= n; j++) {
      cin >> vv[i][j];
      a[i + j] += vv[i][j];
      b[i - j + n] += vv[i][j];
    }
  }
  int long long u = 0, v = 0, w = 0, x = 0, max1 = -1, max2 = -1;
  for (int long long i = 1; i <= n; i++) {
    for (int long long j = 1; j <= n; j++) {
      if ((i + j) % 2 == 0) {
        int long long sum1 = a[i + j] + b[i - j + n] - vv[i][j];
        if (sum1 > max1) {
          u = i;
          v = j;
          max1 = sum1;
        }
      } else {
        int long long sum2 = a[i + j] + b[i - j + n] - vv[i][j];
        if (sum2 > max2) {
          w = i;
          x = j;
          max2 = sum2;
        }
      }
    }
  }
  cout << max1 + max2 << endl;
  if (u + v > w + x) {
    cout << w << " " << x << " " << u << " " << v << endl;
  } else {
    cout << u << " " << v << " " << w << " " << x << endl;
  }
  return 0;
}
