#include <bits/stdc++.h>
using namespace std;
const long long N = 2e3 + 10;
const long long inf = 1e18 + 10;
long long n, a[N][N], cheo1[2 * N], cheo2[2 * N], ma[2], x[2], y[2];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      cheo1[i + j] += a[i][j];
      cheo2[i - j + n] += a[i][j];
    }
  }
  for (long long i = 0; i <= 1; i++) {
    ma[i] = -inf;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      long long sum = cheo1[i + j] + cheo2[i - j + n] - a[i][j];
      long long t = (i + j) % 2;
      if (sum > ma[t]) {
        x[t] = i;
        y[t] = j;
        ma[t] = sum;
      }
    }
  }
  cout << ma[0] + ma[1] << "\n";
  cout << x[0] << " " << y[0] << " " << x[1] << " " << y[1];
}
