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>
using namespace std;
const int Mn = 5e5 + 17;
const int INF = 1e9 + 66;
int a[2 * Mn];
struct info {
  long long sum, rmx;
  int pos;
  info() {}
  info(long long _v, int _p) { sum = _v, rmx = _v, pos = _p; }
  friend info operator+(const info &i, const info &j) {
    info rnt;
    rnt.sum = i.sum + j.sum;
    if (j.rmx > i.rmx + j.sum) {
      rnt.rmx = j.rmx;
      rnt.pos = j.pos;
    } else {
      rnt.rmx = i.rmx + j.sum;
      rnt.pos = i.pos;
    }
    return rnt;
  }
};
struct S {
  int x, y, c;
  S() {}
  S(int _x, int _y, int _c) { x = _x, y = _y, c = _c; }
} pt[Mn];
inline bool cmp(S x, S y) { return x.y < y.y; }
struct tree {
  int left, right;
  info mes;
} tree[Mn * 2 * 4];
int Node = 0;
void build(int l, int r, int x) {
  tree[x].left = l, tree[x].right = r;
  Node = max(Node, x);
  if (l == r) {
    tree[x].mes = info(0ll, l);
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, x << 1);
  build(mid + 1, r, x << 1 | 1);
}
void update(int x, int pos, long long v) {
  if (tree[x].left == tree[x].right) {
    tree[x].mes = info(tree[x].mes.sum + v, tree[x].left);
    return;
  }
  int mid = (tree[x].left + tree[x].right) >> 1;
  if (pos <= mid)
    update(x << 1, pos, v);
  else
    update(x << 1 | 1, pos, v);
  tree[x].mes = tree[x << 1].mes + tree[x << 1 | 1].mes;
}
info query(int x, int l, int r) {
  if (l <= tree[x].left && tree[x].right <= r) return tree[x].mes;
  int mid = (tree[x].left + tree[x].right) >> 1;
  if (r <= mid) return query(x << 1, l, r);
  if (l >= mid + 1) return query(x << 1 | 1, l, r);
  return query(x << 1, l, r) + query(x << 1 | 1, l, r);
}
int main() {
  int n, tail = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x, y, c;
    scanf("%d%d%d", &x, &y, &c);
    pt[i] = S(x, y, c);
    a[tail++] = x, a[tail++] = y;
  }
  sort(a, a + tail);
  tail = unique(a, a + tail) - a;
  for (int i = 0; i < n; ++i) {
    pt[i].x = lower_bound(a, a + tail, pt[i].x) - a;
    pt[i].y = lower_bound(a, a + tail, pt[i].y) - a;
    if (pt[i].x > pt[i].y) swap(pt[i].x, pt[i].y);
  }
  sort(pt, pt + n, cmp);
  build(0, tail - 1, 1);
  long long ans = 0;
  int pos1 = 0, pos2 = 0;
  for (int i = 0, j = 0; i < tail; ++i) {
    while (j < n && pt[j].y <= i) update(1, pt[j].x, pt[j].c), ++j;
    info tmp = query(1, 0, i);
    if (tmp.rmx > ans) ans = tmp.rmx, pos1 = tmp.pos, pos2 = i;
    update(1, i, a[i] - a[i + 1]);
  }
  if (!ans) {
    printf("0\n%d %d %d %d\n", INF, INF, INF, INF);
    return 0;
  }
  printf("%I64d\n", ans);
  printf("%d %d %d %d\n", a[pos1], a[pos1], a[pos2], a[pos2]);
  return 0;
}