#include <bits/stdc++.h>
using namespace std;
long long posx[] = {1, -1, 0, 0};
long long posy[] = {0, 0, 1, -1}, cumu[2002][2002], cumu2[2002][2002];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, q = 900;
  cin >> n;
  long long arr[n + 10][n + 10], ans[n + 10][n + 10];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> arr[i][j];
    }
  }
  memset(cumu, 0, sizeof(cumu));
  memset(cumu2, 0, sizeof(cumu2));
  memset(ans, 0, sizeof(ans));
  bool ok = true;
  for (long long i = 0; i < n && n < q; i++) {
    ok = false;
    for (long long j = 0; j < n; j++) {
      long long x = arr[i][j];
      long long a = i, b = j;
      while (a - 1 >= 0 && b - 1 >= 0) {
        a--, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b + 1 < n) {
        a++, b++;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b - 1 >= 0) {
        a++, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a - 1 >= 0 && b + 1 < n) {
        a--, b++;
        x += arr[a][b];
      }
      ans[i][j] += x;
    }
  }
  long long x1 = 0, y1 = 0, x2 = 0, y2 = 0, mx = -1, anss = 0, anss2, z;
  if (ok) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        cumu[i][j] = cumu[i - 1][j - 1] + arr[i - 1][j - 1];
        cumu2[i][j] = cumu2[i - 1][j + 1] + arr[i - 1][j - 1];
      }
    }
    for (long long i = n - 1; i >= 1; i--) {
      for (long long j = 2; j <= n; j++) {
        cumu2[i][j] = cumu2[i + 1][j - 1];
      }
      for (long long j = 1; j <= n - 1; j++) {
        cumu[i][j] = cumu[i + 1][j + 1];
      }
    }
    anss = -1, anss2 = -1;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        z = cumu[i][j] + cumu2[i][j] - arr[i - 1][j - 1];
        if (!((i + j) % 2 & 1)) {
          if (anss2 < z) {
            anss2 = z;
            x1 = i;
            y1 = j;
          }
        } else {
          if (anss < z) {
            anss = z;
            x2 = i;
            y2 = j;
          }
        }
      }
    }
  }
  if (x1 && y1 && x2 && y2) {
    cout << anss + anss2 << endl;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (ans[i][j] > mx) {
        mx = ans[i][j];
        x1 = i;
        y1 = j;
      }
    }
  }
  ans[x1][y1] = 0;
  anss += mx;
  mx = -1;
  long long a = x1, b = y1, inf = INT_MIN;
  arr[a][b] = inf;
  while (a - 1 >= 0 && b - 1 >= 0) {
    a--, b--;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a + 1 < n && b + 1 < n) {
    a++, b++;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a + 1 < n && b - 1 >= 0) {
    a++, b--;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a - 1 >= 0 && b + 1 < n) {
    a--, b++;
    arr[a][b] = inf;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      long long x = arr[i][j];
      long long a = i, b = j;
      while (a - 1 >= 0 && b - 1 >= 0) {
        a--, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b + 1 < n) {
        a++, b++;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b - 1 >= 0) {
        a++, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a - 1 >= 0 && b + 1 < n) {
        a--, b++;
        x += arr[a][b];
      }
      ans[i][j] = x;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (ans[i][j] > mx) {
        mx = ans[i][j];
        x2 = i;
        y2 = j;
      }
    }
  }
  cout << anss + mx << endl;
  cout << x1 + 1 << " " << y1 + 1 << " " << x2 + 1 << " " << y2 + 1 << endl;
  return 0;
}
