#include <bits/stdc++.h>
using namespace std;
int pow(int x, int y, int p) {
  x = x % p;
  int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    x = (x * x) % p;
    y = y >> 1;
  }
  return res;
}
long long int h(int i, int j) {
  long long int x = i - min(i, j);
  long long int y = j - min(i, j);
  if (x)
    return 0 - x;
  else
    return y;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<vector<long long int> > a(n, vector<long long int>(n));
  map<long long int, long long int> mu, md;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
      mu[i + j] += a[i][j];
      md[h(i, j)] += a[i][j];
    }
  }
  long long int maxe = -1, maxo = -1;
  pair<int, int> e, o;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      long long int sum = mu[i + j] + md[h(i, j)] - a[i][j];
      if ((i + j) % 2 == 0) {
        if (sum > maxe) e = {i + 1, j + 1};
        maxe = max(maxe, sum);
      } else {
        if (sum > maxo) o = {i + 1, j + 1};
        maxo = max(maxo, sum);
      }
    }
  }
  int x1, y1, x2, y2;
  tie(x1, y1) = e;
  tie(x2, y2) = o;
  cout << maxe + maxo << "\n";
  cout << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
}
