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;
long long x[500005], y[500005], c[500005];
long long xi[500005];
map<long long, long long> p;
long long py[1000005], per;
long long up[4 * 1000009];
long long t_max[4 * 1000009];
long long t_i[4 * 1000009];
void build(long long rt, long long l, long long r) {
  if (l == r) {
    t_max[rt] = -py[l];
    t_i[rt] = l;
    return;
  }
  long long mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  if (t_max[rt << 1] > t_max[rt << 1 | 1]) {
    t_max[rt] = t_max[rt << 1];
    t_i[rt] = t_i[rt << 1];
  } else {
    t_max[rt] = t_max[rt << 1 | 1];
    t_i[rt] = t_i[rt << 1 | 1];
  }
}
void push_down(long long rt, long long l, long long r) {
  if (up[rt]) {
    long long mid = (l + r) >> 1;
    t_max[rt << 1] += up[rt];
    t_max[rt << 1 | 1] += up[rt];
    up[rt << 1] += up[rt];
    up[rt << 1 | 1] += up[rt];
    up[rt] = 0;
  }
}
void update(long long rt, long long l, long long r, long long x, long long y,
            long long val) {
  if (x <= l && r <= y) {
    t_max[rt] += val;
    up[rt] += val;
    return;
  }
  if (up[rt]) push_down(rt, l, r);
  long long mid = (l + r) >> 1;
  if (x <= mid) update(rt << 1, l, mid, x, y, val);
  if (y > mid) update(rt << 1 | 1, mid + 1, r, x, y, val);
  if (t_max[rt << 1] > t_max[rt << 1 | 1]) {
    t_max[rt] = t_max[rt << 1];
    t_i[rt] = t_i[rt << 1];
  } else {
    t_max[rt] = t_max[rt << 1 | 1];
    t_i[rt] = t_i[rt << 1 | 1];
  }
}
long long ans_max, ans_i;
void query(long long rt, long long l, long long r, long long x, long long y) {
  if (x <= l && r <= y) {
    if (t_max[rt] > ans_max) {
      ans_max = t_max[rt];
      ans_i = t_i[rt];
    }
    return;
  }
  if (up[rt]) push_down(rt, l, r);
  long long mid = (l + r) >> 1;
  long long maxx = 0;
  if (x <= mid) query(rt << 1, l, mid, x, y);
  if (y > mid) query(rt << 1 | 1, mid + 1, r, x, y);
}
bool cmp(long long a, long long b) { return x[a] < x[b]; }
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    xi[i] = i;
    cin >> x[i] >> y[i] >> c[i];
    if (x[i] > y[i]) swap(x[i], y[i]);
    p[x[i]] = 0, p[y[i]] = 0;
  }
  p[0] = 0;
  for (auto& a : p) {
    py[++per] = a.first;
    a.second = per;
  }
  for (long long i = 1; i <= n; i++) {
    x[i] = p[x[i]];
    y[i] = p[y[i]];
  }
  build(1, 1, per);
  sort(xi + 1, xi + 1 + n, cmp);
  long long ans = 0, ans_l = 1000000001, ans_r = 1000000001;
  for (long long i = 1; i <= n; i++) {
    update(1, 1, per, y[i], per, c[i]);
  }
  for (long long i = 1, j = 1; i <= per; i++) {
    ans_max = -123123123123123123ll, ans_i = 0;
    query(1, 1, per, i, per);
    if (ans_max > ans) {
      ans_l = py[i], ans_r = py[ans_i];
      ans = ans_max;
    }
    for (; x[xi[j]] <= i && j <= n; j++) {
      update(1, 1, per, y[xi[j]], per, -c[xi[j]]);
    }
    if (i != per) update(1, 1, per, i, per, py[i + 1] - py[i]);
  }
  cout << ans << "\n";
  cout << ans_l << " " << ans_l << " " << ans_r << " " << ans_r << "\n";
  return 0;
}