#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 9;
const long long inf = 1e18 + 18;
const int max6 = 1e6 + 6;
const int modx = 1e9 + 123;
const int mody = 997;
const int base = 137;
int a[2005][2005];
long long f[2005][2005];
long long g[2005][2005];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) f[i][j] = f[i - 1][j - 1] + a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) g[i][j] = g[i - 1][j + 1] + a[i][j];
  pair<long long, pair<int, int> > max_odd = {0, {0, 0}};
  pair<long long, pair<int, int> > max_even = {0, {0, 0}};
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      int one = min(n - i, n - j);
      int two = min(n - i, j - 1);
      long long cur = f[i + one][j + one] + g[i + two][j - two] - a[i][j];
      if ((i + j) % 2)
        max_odd = max(max_odd, {cur, {i, j}});
      else
        max_even = max(max_even, {cur, {i, j}});
    }
  cout << max_odd.first + max_even.first << "\n";
  cout << max_odd.second.first << " " << max_odd.second.second << " ";
  cout << max_even.second.first << " " << max_even.second.second << " ";
}
