#include <bits/stdc++.h>
using namespace std;
long long int a[2009][2009];
int n;
map<int, long long int> sum, diff;
pair<long long int, pair<int, int> > b[4000009];
int main() {
  memset(b, 0, sizeof(b));
  scanf("%d", &n);
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(1); j <= int(n); j++) {
      scanf("%lld", &a[i][j]);
      diff[(i - j)] += a[i][j];
      sum[i + j] += a[i][j];
    }
  }
  int co = 0;
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(1); j <= int(n); j++) {
      b[co++] = make_pair(sum[i + j] + diff[i - j] - a[i][j], make_pair(i, j));
    }
  }
  sort(b, b + co);
  reverse(b, b + co);
  int q = n * n;
  long long int ans = b[0].first;
  pair<int, int> fir = b[0].second;
  pair<int, int> sec;
  for (int i = int(1); i <= int(q - 1); i++) {
    if ((abs(b[i].second.first - fir.first) +
         abs(b[i].second.second - fir.second)) %
            2 ==
        1) {
      ans += b[i].first;
      sec = b[i].second;
      break;
    }
  }
  printf("%lld\n", ans);
  printf("%d %d %d %d\n", fir.first, fir.second, sec.first, sec.second);
  return 0;
}
