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 = 1e6 + 1;
long long inf = 1e18;
int X[maxn];
vector<int> G[maxn];
struct seg {
  int pos;
  long long mx, tag;
  seg operator+(const seg& t) const {
    seg tmp;
    tmp.mx = max(mx, t.mx);
    if (mx >= t.mx)
      tmp.pos = pos;
    else
      tmp.pos = t.pos;
    return tmp;
  }
} tree[maxn * 4];
void build(int o, int l, int r) {
  if (l == r) {
    tree[o].pos = l;
    tree[o].tag = tree[o].mx = 0;
    return;
  }
  build(o * 2, l, (l + r) / 2);
  build(o * 2 + 1, (l + r) / 2 + 1, r);
  tree[o] = tree[o * 2] + tree[o * 2 + 1];
}
void pushdown(int o) {
  if (tree[o].tag) {
    long long tag = tree[o].tag;
    tree[o * 2].tag += tag;
    tree[o * 2 + 1].tag += tag;
    tree[o * 2].mx += tag;
    tree[o * 2 + 1].mx += tag;
    tree[o].tag = 0;
  }
}
void up(int o, int l, int r, int ql, int qr, long long v) {
  if (l >= ql && r <= qr) {
    tree[o].mx += v;
    tree[o].tag += v;
    return;
  }
  pushdown(o);
  if (ql <= (l + r) / 2) up(o * 2, l, (l + r) / 2, ql, qr, v);
  if (qr > (l + r) / 2) up(o * 2 + 1, (l + r) / 2 + 1, r, ql, qr, v);
  tree[o] = tree[o * 2] + tree[o * 2 + 1];
}
seg qu(int o, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) return tree[o];
  pushdown(o);
  if (qr <= (l + r) / 2)
    return qu(o * 2, l, (l + r) / 2, ql, qr);
  else if (ql > (l + r) / 2)
    return qu(o * 2 + 1, (l + r) / 2 + 1, r, ql, qr);
  else
    return qu(o * 2, l, (l + r) / 2, ql, qr) +
           qu(o * 2 + 1, (l + r) / 2 + 1, r, ql, qr);
}
int x[maxn], y[maxn], w[maxn];
int main() {
  int n, sz = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x[i], &y[i], &w[i]);
    X[++sz] = x[i];
    X[++sz] = y[i];
  }
  sort(X + 1, X + 1 + sz);
  sz = unique(X + 1, X + 1 + sz) - X - 1;
  for (int i = 1; i <= n; i++) {
    x[i] = lower_bound(X + 1, X + 1 + sz, x[i]) - X;
    y[i] = lower_bound(X + 1, X + 1 + sz, y[i]) - X;
    G[max(x[i], y[i])].push_back(i);
  }
  build(1, 1, sz);
  long long ans = -inf, cat = 0;
  int x1 = 1, x2 = 1;
  for (int i = 1; i <= sz; i++) {
    for (auto id : G[i]) {
      cat += w[id];
      int k = max(x[id], y[id]);
      up(1, 1, sz, k, sz, w[id]);
      up(1, 1, sz, x[id], sz, -w[id]);
      up(1, 1, sz, y[id], sz, -w[id]);
    }
    if (i != 1) {
      seg tmp = qu(1, 1, sz, 1, i - 1);
      long long res = tmp.mx + cat - X[i];
      if (res > ans) {
        ans = res;
        x1 = X[tmp.pos + 1];
        x2 = X[i];
      }
    }
    if (cat - (X[i] - X[1]) > ans) {
      ans = cat - (X[i] - X[1]);
      x1 = X[1];
      x2 = X[i];
    }
    up(1, 1, sz, i, i, X[i + 1]);
  }
  if (ans < 0) {
    ans = 0;
    x1 = x2 = X[sz] + 1;
  }
  printf("%lld\n%d %d %d %d", ans, x1, x1, x2, x2);
}