Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.

He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of them. Consider a cell with number x written on it, if this cell is attacked by one of the bishops Gargari will get x dollars for it. Tell Gargari, how to place bishops on the chessboard to get maximum amount of money.

We assume a cell is attacked by a bishop, if the cell is located on the same diagonal with the bishop (the cell, where the bishop is, also considered attacked by it).

Input

The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.

Output

On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are numbered from 1 to n from top to bottom, and columns are numbered from 1 to n from left to right.

If there are several optimal solutions, you can print any of them.

Examples

Input

4
1 1 1 1
2 1 1 0
1 1 1 0
1 0 0 1


Output

12
2 2 3 2
#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N |= (1LL << pos); }
int Reset(int N, int pos) { return N &= ~(1LL << pos); }
bool Check(int N, int pos) { return N & (1LL << pos); }
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}, dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
long long n, ar[2001][2001], tot, s, dp1[2001][2001], M1 = 0, M = 0, tem;
long long x1, y11, x2, y2;
int main() {
  ios_base::sync_with_stdio(false);
  M = -1;
  M1 = -1;
  cin >> n;
  for (int i(1), _n(n); i <= _n; ++i) {
    for (int j(1), _n(n); j <= _n; ++j) {
      cin >> ar[i][j];
    }
  }
  for (int i = 1; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s <= n; j++) {
      tot += ar[s][j];
      s++;
    }
    s = i;
    for (int j = 1; j <= n && s <= n; j++) {
      dp1[s][j] = tot;
      s++;
    }
  }
  for (int i = 3; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s <= n; j++) {
      tot += ar[j][s];
      s++;
    }
    s = i;
    for (int j = 1; j <= n && s <= n; j++) {
      dp1[j][s] = tot;
      s++;
    }
  }
  for (int i = 1; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s >= 1; j++) {
      tot += ar[s][j];
      s--;
    }
    s = i;
    for (int j = 1; j <= n && s >= 1; j++) {
      dp1[s][j] += tot - ar[s][j];
      tem = dp1[s][j];
      if (tem > M1) {
        M1 = tem;
        x1 = s;
        y11 = j;
      }
      s--;
    }
  }
  int si;
  if ((n % 2) == 0)
    si = 2;
  else
    si = 3;
  for (int i = si; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = n; j >= 1 && s <= n; j--) {
      tot += ar[j][s];
      s++;
    }
    s = i;
    for (int j = n; j >= 1 && s <= n; j--) {
      dp1[s][j] += tot - ar[s][j];
      tem = dp1[s][j];
      if (tem > M1) {
        M1 = tem;
        x1 = s;
        y11 = j;
      }
      s++;
    }
  }
  memset(dp1, 0, sizeof(dp1));
  for (int i = 2; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s <= n; j++) {
      tot += ar[s][j];
      s++;
    }
    s = i;
    for (int j = 1; j <= n && s <= n; j++) {
      dp1[s][j] = tot;
      s++;
    }
  }
  for (int i = 2; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s <= n; j++) {
      tot += ar[j][s];
      s++;
    }
    s = i;
    for (int j = 1; j <= n && s <= n; j++) {
      dp1[j][s] = tot;
      s++;
    }
  }
  for (int i = 2; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = 1; j <= n && s >= 1; j++) {
      tot += ar[s][j];
      s--;
    }
    s = i;
    for (int j = 1; j <= n && s >= 1; j++) {
      tem = dp1[s][j] + tot - ar[s][j];
      if (tem > M) {
        M = tem;
        x2 = s;
        y2 = j;
      }
      s--;
    }
  }
  if (n % 2 == 1)
    si = 2;
  else
    si = 3;
  for (int i = si; i <= n; i += 2) {
    s = i;
    tot = 0;
    for (int j = n; j >= 1 && s <= n; j--) {
      tot += ar[s][j];
      s++;
    }
    s = i;
    for (int j = n; j >= 1 && s <= n; j--) {
      tem = dp1[s][j] + tot - ar[s][j];
      if (tem > M) {
        M = tem;
        x2 = s;
        y2 = j;
      }
      s++;
    }
  }
  cout << M + M1 << endl;
  cout << x1 << " " << y11 << " " << x2 << " " << y2 << endl;
  return 0;
}
