#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }
  vector<vector<long long>> diag1(n, vector<long long>(n)),
      diag2(n, vector<long long>(n));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      diag1[i - min(i, j)][j - min(i, j)] += a[i][j];
      diag2[i - min(i, n - j - 1)][j + min(i, n - j - 1)] += a[i][j];
    }
  }
  vector<long long> sum(2);
  vector<pair<int, int>> bishops(2);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      int pos = (i + j) % 2;
      long long s = diag1[i - min(i, j)][j - min(i, j)] +
                    diag2[i - min(i, n - j - 1)][j + min(i, n - j - 1)] -
                    a[i][j];
      if (sum[pos] <= s) {
        sum[pos] = s;
        bishops[pos] = {i + 1, j + 1};
      }
    }
  }
  cout << sum[0] + sum[1] << '\n'
       << bishops[0].first << ' ' << bishops[0].second << ' '
       << bishops[1].first << ' ' << bishops[1].second << '\n';
  return 0;
}
