#include <bits/stdc++.h>
const int N = 2010;
int a[N][N];
long long sum[4][N][N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", a[i] + j);
  for (int i = 1; i <= n; ++i)
    for (int j = n; j >= 1; --j) sum[0][i][j] = sum[0][i - 1][j + 1] + a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) sum[1][i][j] = sum[1][i - 1][j - 1] + a[i][j];
  for (int i = n; i >= 1; --i)
    for (int j = 1; j <= n; ++j) sum[2][i][j] = sum[2][i + 1][j - 1] + a[i][j];
  for (int i = n; i >= 1; --i)
    for (int j = n; j >= 1; --j) sum[3][i][j] = sum[3][i + 1][j + 1] + a[i][j];
  long long best1 = -1;
  int x1 = 0, y1 = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = (i & 1) + 1; j <= n; j += 2) {
      long long val = sum[0][i][j] + sum[1][i][j] + sum[2][i][j] +
                      sum[3][i][j] - 3LL * a[i][j];
      if (val > best1) {
        best1 = val;
        x1 = i;
        y1 = j;
      }
    }
  }
  long long best2 = -1;
  int x2 = 0, y2 = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = (!(i & 1)) + 1; j <= n; j += 2) {
      long long val = sum[0][i][j] + sum[1][i][j] + sum[2][i][j] +
                      sum[3][i][j] - 3LL * a[i][j];
      if (val > best2) {
        best2 = val;
        x2 = i;
        y2 = j;
      }
    }
  }
  printf("%I64d\n", best1 + best2);
  printf("%d %d %d %d", x1, y1, x2, y2);
}
