#include <bits/stdc++.h>
using namespace std;
long long int sol[2];
pair<long long int, long long int> v[2];
long long int a[2000 + 1][2000 + 1], sum1[2000 * 3], sum2[2000 * 3];
void change(long long int x, long long int i, long long int j,
            long long int val) {
  if (val > sol[x]) {
    v[x].first = i;
    v[x].second = j;
    sol[x] = val;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j <= n; j++) {
      cin >> a[i][j];
      sum1[i + j] += a[i][j];
      sum2[i - j + n] += a[i][j];
    }
  }
  sol[0] = sol[1] = -1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j <= n; j++) {
      change((i + j) & 1, i, j, sum1[i + j] + sum2[i - j + n] - a[i][j]);
    }
  }
  cout << sol[0] + sol[1] << endl;
  cout << v[0].first << " " << v[0].second << endl;
  cout << v[1].first << " " << v[1].second << endl;
  return 0;
}
