#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
const long long N = 2010;
long long v[N][N], color[N][N], sum[N][N], sum1[N][N], n;
void start(long long i, long long j) {
  long long i1 = i, j1 = j;
  long long lol = 0;
  while (i1 < n && j1 < n) {
    lol += v[i1][j1];
    i1++, j1++;
  }
  i1 = i, j1 = j;
  while (i1 < n && j1 < n) {
    sum[i1][j1] = lol;
    i1++, j1++;
  }
}
void start1(long long i, long long j) {
  long long i1 = i, j1 = j;
  long long lol = 0;
  while (i1 < n && j1 >= 0) {
    lol += v[i1][j1];
    i1++, j1--;
  }
  i1 = i, j1 = j;
  while (i1 < n && j1 >= 0) {
    sum1[i1][j1] = lol;
    i1++, j1--;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> v[i][j];
    }
  }
  for (long long i = 0; i < n; i++) {
    long long x = i % 2;
    for (long long j = 0; j < n; j++) {
      color[i][j] = x;
      x = (x + 1) % 2;
    }
  }
  for (long long j = 0; j < n; j++) {
    start(0, j);
    start1(0, j);
  }
  for (long long i = 0; i < n; i++) {
    start(i, 0);
  }
  for (long long i = 0; i < n; i++) {
    start1(i, n - 1);
  }
  long long ans = 0;
  vector<long long> ll(2, -1e18);
  vector<pair<long long, long long>> pp(2);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      bool x = color[i][j];
      if (sum[i][j] + sum1[i][j] - v[i][j] > ll[x]) {
        ll[x] = sum[i][j] + sum1[i][j] - v[i][j], pp[x] = {i + 1, j + 1};
      }
    }
  }
  cout << ll[0] + ll[1] << endl;
  cout << pp[0].first << " " << pp[0].second << " " << pp[1].first << " "
       << pp[1].second;
  return 0;
}
