#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<long long, long long> d1, d2;
  vector<vector<long long>> ar(n, vector<long long>(n));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> ar[i][j];
      d1[i - j] += ar[i][j];
      d2[i + j] += ar[i][j];
    }
  }
  vector<long long> s0(3, -1), s1(3, -1);
  vector<long long> ans(5, -1);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) {
      if ((i + j) % 2 == 0) {
        long long temp = d1[i - j] + d2[i + j] - ar[i][j];
        if (temp > s0[0]) s0 = {temp, i, j};
        if (s1[0] != -1) {
          auto it = s1;
          temp += it[0];
          if (temp > ans[0]) ans = {temp, i + 1, j + 1, it[1] + 1, it[2] + 1};
        }
      } else {
        long long temp = d1[i - j] + d2[i + j] - ar[i][j];
        if (temp > s1[0]) s1 = {temp, i, j};
        if (s0[0] != -1) {
          auto it = s0;
          temp += it[0];
          if (temp > ans[0]) ans = {temp, i + 1, j + 1, it[1] + 1, it[2] + 1};
        }
      }
    }
  cout << ans[0] << "\n";
  for (long long i = 1; i <= 4; i++) cout << ans[i] << " ";
  return 0;
}
