Problem: Petya recently found a game "Choose a Square". In this game, there are n points numbered from 1 to n on an infinite field. The i-th point has coordinates (x_i, y_i) and cost c_i.

You have to choose a square such that its sides are parallel to coordinate axes, the lower left and upper right corners belong to the line y = x, and all corners have integer coordinates.

The score you get is the sum of costs of the points covered by the selected square minus the length of the side of the square. Note that the length of the side can be zero.

Petya asks you to calculate the maximum possible score in the game that can be achieved by placing exactly one square.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the number of points on the field.

Each of the following n lines contains three integers x_i, y_i, c_i (0 ≤ x_i, y_i ≤ 10^9, -10^6 ≤ c_i ≤ 10^6) — coordinates of the i-th point and its cost, respectively.

Output

In the first line print the maximum score Petya can achieve.

In the second line print four integers x_1, y_1, x_2, y_2 (0 ≤ x_1, y_1, x_2, y_2 ≤ 2 ⋅ 10^9, x_1 = y_1, x_2 = y_2, x_1 ≤ x_2) separated by spaces — the coordinates of the lower left and upper right corners of the square which Petya has to select in order to achieve the maximum score.

Examples

Input


6
0 0 2
1 0 -5
1 1 3
2 3 4
1 4 -4
3 1 -1


Output


4
1 1 3 3


Input


5
3 3 0
3 3 -3
0 2 -1
3 1 3
0 0 -2


Output


0
1 1 1 1

Note

The field corresponding to the first example: <image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long INF = 1e16 + 7;
const int MAXN = 5e5 + 5;
pair<int, int> a[MAXN], b[MAXN];
int L[MAXN * 4], R[MAXN * 4], segsz = 1;
long long val[MAXN];
struct node {
  long long sm, mxpre;
  int ind;
} seg[MAXN * 4];
node operator+(node l, node r) {
  node ret = {0, 0, 0};
  ret.sm = l.sm + r.sm;
  ret.ind = l.ind;
  if (l.mxpre < l.sm + r.mxpre) ret.ind = r.ind;
  ret.mxpre = max(l.mxpre, l.sm + r.mxpre);
  return ret;
}
void upd(int l, int r, int& k, int a, long long v, int idx) {
  if (!k) {
    k = ++segsz;
    seg[k].sm = 0;
    seg[k].mxpre = -INF;
    seg[k].ind = -1;
  }
  if (a < l || r < a) return;
  if (a <= l && r <= a) {
    seg[k].sm += v;
    seg[k].mxpre = seg[k].sm - idx;
    seg[k].ind = idx;
    return;
  }
  int m = (l + r) / 2;
  upd(l, m, L[k], a, v, idx);
  upd(m + 1, r, R[k], a, v, idx);
  seg[k] = seg[L[k]] + seg[R[k]];
}
node qry(int l, int r, int k, int a) {
  if (!k) {
    node ret;
    ret.sm = 0;
    ret.mxpre = -INF;
    ret.ind = -1;
    return ret;
  }
  if (a <= l) return seg[k];
  int m = (l + r) / 2;
  if (a <= m) return qry(l, m, L[k], a) + qry(m + 1, r, R[k], a);
  return qry(m + 1, r, R[k], a);
}
int main() {
  vector<pair<int, int> > arr;
  int n;
  scanf("%d", &(n));
  int root = 1;
  seg[1].sm = 0;
  seg[1].mxpre = 0;
  seg[1].ind = 0;
  map<int, int> mrk;
  vector<int> tmp;
  for (int i = 0; i < n; i++) {
    scanf("%d %d %I64d", &a[i].first, &a[i].second, &val[i]);
    if (a[i].first > a[i].second) swap(a[i].first, a[i].second);
    tmp.push_back(a[i].first);
    tmp.push_back(a[i].second);
    arr.push_back(make_pair(a[i].first, i));
    mrk[a[i].first] = 1;
    mrk[a[i].second] = 1;
  }
  sort(tmp.begin(), tmp.end());
  tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
  for (int i = 0; i < n; i++) {
    b[i].first = lower_bound(tmp.begin(), tmp.end(), a[i].first) - tmp.begin();
    b[i].second =
        lower_bound(tmp.begin(), tmp.end(), a[i].second) - tmp.begin();
  }
  sort(arr.begin(), arr.end());
  long long ans = -1;
  int lo = 0, hi = 0;
  for (int i = n - 1; i >= 0;) {
    int j = i;
    for (; j >= 0 && arr[i].first == arr[j].first; j--)
      upd(0, 2 * n, root, b[arr[j].second].second, val[arr[j].second],
          a[arr[j].second].second);
    node cur = qry(0, 2 * n, root, b[arr[i].second].first);
    if (ans < cur.mxpre + arr[i].first) {
      ans = cur.mxpre + arr[i].first;
      lo = arr[i].first;
      hi = cur.ind;
    }
    i = j;
  }
  if (ans == -1) {
    ans = 0;
    for (int i = 0; i <= 2 * n; i++)
      if (!mrk.count(i)) {
        lo = hi = i;
        break;
      }
  }
  printf("%I64d\n", (ans));
  printf("%d %d %d %d\n", lo, lo, hi, hi);
  return 0;
}