#include <bits/stdc++.h>
using namespace std;
const int N = 2005, MOD = 1e9 + 7, MAX = 1e5;
int n;
int a[N][N];
long long r[4 * N], l[4 * N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &a[i][j]);
      r[i + j] += a[i][j];
      l[i - j + n] += a[i][j];
    }
  }
  pair<long long, pair<int, int> > best[2];
  best[0].first = best[1].first = -1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if ((r[i + j] + l[i - j + n] - a[i][j]) > best[(i + j) % 2].first) {
        int wa = (i + j) % 2;
        best[wa].first = r[i + j] + l[i - j + n] - a[i][j];
        best[wa].second.first = i;
        best[wa].second.second = j;
      }
    }
  }
  printf("%lld\n%d %d %d %d", best[0].first + best[1].first,
         best[0].second.first, best[0].second.second, best[1].second.first,
         best[1].second.second);
  return 0;
}
