#include <bits/stdc++.h>
using namespace std;
long long int ans[2], d1[2 * 2001], d2[2 * 2001], a[2001][2001];
pair<int, int> v[2];
void update(int parity, int i, int j, long long int sum) {
  if (sum > ans[parity]) {
    ans[parity] = sum;
    v[parity].first = i;
    v[parity].second = j;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  memset(d1, 0, sizeof(d1));
  memset(d2, 0, sizeof(d2));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> a[i][j];
      d1[i + j] += a[i][j];
      d2[i - j + n] += a[i][j];
    }
  }
  ans[0] = ans[1] = -1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      update((i + j & 1), i, j, d1[i + j] + d2[i - j + n] - a[i][j]);
    }
  }
  cout << ans[0] + ans[1] << endl;
  cout << v[0].first << " " << v[0].second << " " << v[1].first << " "
       << v[1].second;
  return 0;
}
