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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int N = 1e6 + 7;
const long long INF = 1e18;
int n, x[N], y[N], c[N], t[N], xx[N], yy[N];
struct dat {
  int l, r, val, id;
  dat(int _l = 0, int _r = 0, int _val = 0, int _id = 0) {
    l = _l, r = _r, val = _val, id = _id;
  }
  inline bool operator<(const dat &tmp) const {
    if (l != tmp.l) return l > tmp.l;
    return r != tmp.r ? r < tmp.r : val > tmp.val;
  }
} d[N];
int tot;
int inv[N];
struct SegTree {
  long long T[N << 2], id[N << 2], tag[N << 2];
  inline void pushup(int o) {
    T[o] = max(T[o << 1], T[o << 1 | 1]);
    id[o] = T[o << 1] >= T[o << 1 | 1] ? id[o << 1] : id[o << 1 | 1];
  }
  inline void pushdown(int o, int l, int r) {
    if (!o || !tag[o]) return;
    T[o] += tag[o];
    if (l == r) {
      tag[o] = 0;
      return;
    }
    tag[o << 1] += tag[o];
    tag[o << 1 | 1] += tag[o];
    tag[o] = 0;
  }
  void build(int o, int l, int r) {
    if (l == r) {
      id[o] = l;
      T[o] = -inv[l];
      return;
    }
    int mid = l + r >> 1;
    build(o << 1, l, mid);
    build(o << 1 | 1, mid + 1, r);
    pushup(o);
  }
  inline void change(int o, int l, int r, int ql, int qr, int v) {
    pushdown(o, l, r);
    if (l > qr || r < ql) return;
    if (l >= ql && r <= qr) {
      tag[o] = v;
      pushdown(o, l, r);
      return;
    }
    int mid = l + r >> 1;
    change(o << 1, l, mid, ql, qr, v);
    change(o << 1 | 1, mid + 1, r, ql, qr, v);
    pushup(o);
  }
  long long pos, val;
  inline void query(int o, int l, int r, int ql, int qr) {
    pushdown(o, l, r);
    if (l > qr || r < ql) return;
    if (l >= ql && r <= qr) {
      if (T[o] > val) val = T[o], pos = id[o];
      return;
    }
    int mid = l + r >> 1;
    query(o << 1, l, mid, ql, qr);
    query(o << 1 | 1, mid + 1, r, ql, qr);
    pushup(o);
  }
} ST;
int main() {
  n = read();
  for (int i = 1; i <= n; i++)
    xx[i] = x[i] = read(), yy[i] = y[i] = read(), c[i] = read();
  for (int i = 1; i <= n; i++) t[++tot] = x[i], t[++tot] = y[i];
  sort(t + 1, t + tot + 1);
  tot = unique(t + 1, t + tot + 1) - t - 1;
  for (int i = 1; i <= n; i++) x[i] = lower_bound(t + 1, t + tot + 1, x[i]) - t;
  for (int i = 1; i <= n; i++) y[i] = lower_bound(t + 1, t + tot + 1, y[i]) - t;
  int ansx = 0, ansy = 0;
  for (int i = 1; i <= n; i++) {
    if (x[i] > y[i]) swap(x[i], y[i]), swap(xx[i], yy[i]);
    d[i] = dat(x[i], y[i], c[i], i);
    ansx = max(ansx, yy[i] + 1);
    ansy = max(ansy, yy[i] + 1);
    inv[x[i]] = xx[i];
    inv[y[i]] = yy[i];
  }
  sort(d + 1, d + n + 1);
  long long ans = 0;
  ST.build(1, 1, tot);
  d[n + 1].l = -233;
  for (int i = 1; i <= n; i++) {
    ST.change(1, 1, tot, d[i].r, tot, d[i].val);
    ST.val = -INF;
    ST.pos = 0;
    if (d[i].l == d[i + 1].l)
      ST.query(1, 1, tot, d[i].r, d[i + 1].r - 1);
    else
      ST.query(1, 1, tot, d[i].r, tot);
    long long res = ST.val + inv[d[i].l];
    if (res > ans) ans = res, ansx = inv[d[i].l], ansy = inv[ST.pos];
  }
  printf("%lld\n", ans);
  printf("%d %d %d %d\n", ansx, ansx, ansy, ansy);
  return 0;
}