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 maxn = 5e5 + 10;
int n;
long long x[maxn], y[maxn], a[maxn << 1], c[maxn], pos[maxn << 1];
vector<pair<long long, long long> > vc[maxn << 1];
struct SegmentTree {
  struct node {
    long long maxx, pos;
  } tr[maxn << 3];
  long long tag[maxn << 3];
  void pushup(int rt) {
    if (tr[rt << 1].maxx > tr[rt << 1 | 1].maxx)
      tr[rt] = tr[rt << 1];
    else
      tr[rt] = tr[rt << 1 | 1];
  }
  void load(int rt, long long k) {
    tr[rt].maxx += k;
    tag[rt] += k;
  }
  void pushdown(int rt) {
    if (!tag[rt]) return;
    load(rt << 1, tag[rt]);
    load(rt << 1 | 1, tag[rt]);
    tag[rt] = 0LL;
  }
  void build(int rt, int l, int r) {
    tag[rt] = 0LL;
    if (r == l) {
      tr[rt] = {0, l};
      return;
    }
    int mid = (l + r) >> 1;
    build(rt << 1, l, mid);
    build(rt << 1 | 1, mid + 1, r);
    pushup(rt);
  }
  void update(int nl, int nr, int l, int r, int rt, long long k) {
    if (nl <= l && nr >= r) {
      load(rt, k);
      return;
    }
    pushdown(rt);
    int mid = (l + r) >> 1;
    if (nl <= mid) update(nl, nr, l, mid, rt << 1, k);
    if (nr >= mid + 1) update(nl, nr, mid + 1, r, rt << 1 | 1, k);
    pushup(rt);
  }
  node query(int nl, int nr, int l, int r, int rt) {
    if (nl <= l && nr >= r) return tr[rt];
    pushdown(rt);
    int mid = (l + r) >> 1;
    if (nl <= mid) {
      if (nr >= mid + 1) {
        node ret1 = query(nl, nr, l, mid, rt << 1);
        node ret2 = query(nl, nr, mid + 1, r, rt << 1 | 1);
        if (ret1.maxx > ret2.maxx) return ret1;
        return ret2;
      }
      return query(nl, nr, l, mid, rt << 1);
    }
    return query(nl, nr, mid + 1, r, rt << 1 | 1);
  }
} seg;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld %lld", x + i, y + i, c + i);
    if (x[i] > y[i]) swap(x[i], y[i]);
    a[i] = x[i], a[i + n] = y[i];
  }
  sort(a + 1, a + 1 + 2 * n);
  int tot = unique(a + 1, a + 1 + 2 * n) - (a + 1);
  for (int i = 1; i <= tot; i++) pos[i] = a[i];
  for (int i = 1; i <= n; i++) {
    x[i] = lower_bound(a + 1, a + 1 + tot, x[i]) - a;
    y[i] = lower_bound(a + 1, a + 1 + tot, y[i]) - a;
    vc[y[i]].push_back(make_pair(x[i], c[i]));
  }
  long long ans = 0LL, xx = INT_MAX, yy = INT_MAX;
  for (int i = 1; i <= tot; i++)
    if (pos[i] != i) xx = yy = i;
  seg.build(1, 1, tot);
  for (int i = 1; i <= tot; i++) {
    for (auto it : vc[i]) seg.update(1, it.first, 1, tot, 1, it.second);
    if (i != 1) seg.update(1, i - 1, 1, tot, 1, pos[i - 1] - pos[i]);
    SegmentTree ::node ret = seg.query(1, i, 1, tot, 1);
    if (ret.maxx > ans) {
      ans = ret.maxx;
      xx = pos[ret.pos];
      yy = pos[i];
    }
  }
  printf("%lld\n%lld %lld %lld %lld", ans, xx, xx, yy, yy);
  return 0;
}