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;
long long posx[] = {1, -1, 0, 0};
long long posy[] = {0, 0, 1, -1}, cumu[2002][2002], cumu2[2002][2002];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, q = 900;
  cin >> n;
  long long arr[n + 10][n + 10], ans[n + 10][n + 10];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> arr[i][j];
    }
  }
  memset(cumu, 0, sizeof(cumu));
  memset(cumu2, 0, sizeof(cumu2));
  memset(ans, 0, sizeof(ans));
  bool ok = true;
  for (long long i = 0; i < n && n < q; i++) {
    ok = false;
    for (long long j = 0; j < n; j++) {
      long long x = arr[i][j];
      long long a = i, b = j;
      while (a - 1 >= 0 && b - 1 >= 0) {
        a--, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b + 1 < n) {
        a++, b++;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b - 1 >= 0) {
        a++, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a - 1 >= 0 && b + 1 < n) {
        a--, b++;
        x += arr[a][b];
      }
      ans[i][j] += x;
    }
  }
  long long x1 = 0, y1 = 0, x2 = 0, y2 = 0, mx = -1, anss = 0, anss2, z;
  if (ok) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        cumu[i][j] = cumu[i - 1][j - 1] + arr[i - 1][j - 1];
        cumu2[i][j] = cumu2[i - 1][j + 1] + arr[i - 1][j - 1];
      }
    }
    for (long long i = n - 1; i >= 1; i--) {
      for (long long j = 2; j <= n; j++) {
        cumu2[i][j] = cumu2[i + 1][j - 1];
      }
      for (long long j = 1; j <= n - 1; j++) {
        cumu[i][j] = cumu[i + 1][j + 1];
      }
    }
    anss = -1, anss2 = -1;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        z = cumu[i][j] + cumu2[i][j] - arr[i - 1][j - 1];
        if (!((i + j) % 2 & 1)) {
          if (anss2 < z) {
            anss2 = z;
            x1 = i;
            y1 = j;
          }
        } else {
          if (anss < z) {
            anss = z;
            x2 = i;
            y2 = j;
          }
        }
      }
    }
  }
  if (x1 && y1 && x2 && y2) {
    cout << anss + anss2 << endl;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (ans[i][j] > mx) {
        mx = ans[i][j];
        x1 = i;
        y1 = j;
      }
    }
  }
  ans[x1][y1] = 0;
  anss += mx;
  mx = -1;
  long long a = x1, b = y1, inf = INT_MIN;
  arr[a][b] = inf;
  while (a - 1 >= 0 && b - 1 >= 0) {
    a--, b--;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a + 1 < n && b + 1 < n) {
    a++, b++;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a + 1 < n && b - 1 >= 0) {
    a++, b--;
    arr[a][b] = inf;
  }
  a = x1, b = y1;
  while (a - 1 >= 0 && b + 1 < n) {
    a--, b++;
    arr[a][b] = inf;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      long long x = arr[i][j];
      long long a = i, b = j;
      while (a - 1 >= 0 && b - 1 >= 0) {
        a--, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b + 1 < n) {
        a++, b++;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a + 1 < n && b - 1 >= 0) {
        a++, b--;
        x += arr[a][b];
      }
      a = i, b = j;
      while (a - 1 >= 0 && b + 1 < n) {
        a--, b++;
        x += arr[a][b];
      }
      ans[i][j] = x;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (ans[i][j] > mx) {
        mx = ans[i][j];
        x2 = i;
        y2 = j;
      }
    }
  }
  cout << anss + mx << endl;
  cout << x1 + 1 << " " << y1 + 1 << " " << x2 + 1 << " " << y2 + 1 << endl;
  return 0;
}
