#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
const int maxn = 4004;
long long int n;
long long int a[2001][2001];
long long int pos[maxn], neg[maxn];
long long int ans, x1, yy1, x2, y2;
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%lld", &a[i][j]);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      pos[2000 + i - j] += a[i][j];
      neg[i + j] += a[i][j];
    }
  }
  long long int posi = 0;
  ans = INT_MIN;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j + posi <= n; j += 2) {
      if (ans < pos[2000 + i - j - posi] + neg[i + j + posi] - a[i][j + posi]) {
        ans = pos[2000 + i - j - posi] + neg[i + j + posi] - a[i][j + posi];
        x1 = i;
        yy1 = j + posi;
      }
    }
    posi = (posi + 1) % 2;
  }
  posi = 1;
  long long int temp_ans = INT_MIN;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j + posi <= n; j += 2) {
      if (temp_ans <
          pos[2000 + i - j - posi] + neg[i + j + posi] - a[i][j + posi]) {
        temp_ans =
            pos[2000 + i - j - posi] + neg[i + j + posi] - a[i][j + posi];
        x2 = i;
        y2 = j + posi;
      }
    }
    posi = (posi + 1) % 2;
  }
  printf("%lld\n", ans + temp_ans);
  printf("%lld %lld %lld %lld\n", x1, yy1, x2, y2);
  return 0;
}
