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 long long M = 1e5 + 10, M2 = 1e6 + 10, oo = 1e18 + 7;
pair<long long, long long> st[4 * M2];
long long lz[4 * M2];
pair<pair<long long, long long>, long long> ara[M2];
vector<long long> vals;
long long n;
vector<pair<long long, long long> > others[M2];
void build(long long v = 1, long long tl = 0, long long tr = n - 1) {
  if (tl == tr) {
    st[v] = pair<long long, long long>(-vals[tl], tl);
    return;
  }
  long long mid = (tl + tr) / 2;
  build(v * 2, tl, mid);
  build(v * 2 + 1, mid + 1, tr);
  st[v] = max(st[v * 2], st[v * 2 + 1]);
}
void push(long long v = 1, long long tl = 0, long long tr = n - 1) {
  if (!lz[v]) return;
  st[v].first += lz[v];
  if (tl != tr) {
    lz[v * 2] += lz[v];
    lz[v * 2 + 1] += lz[v];
  }
  lz[v] = 0;
}
void upd(long long l, long long r, long long vl, long long v = 1,
         long long tl = 0, long long tr = n - 1) {
  push(v, tl, tr);
  if (tl >= l && tr <= r) {
    lz[v] += vl;
    push(v, tl, tr);
    return;
  }
  long long mid = (tl + tr) / 2;
  if (mid >= l) upd(l, r, vl, v * 2, tl, mid);
  push(v * 2, tl, mid);
  if (mid < r) upd(l, r, vl, v * 2 + 1, mid + 1, tr);
  push(v * 2 + 1, mid + 1, tr);
  st[v] = max(st[v * 2], st[v * 2 + 1]);
}
pair<long long, long long> qry(long long l, long long r, long long v = 1,
                               long long tl = 0, long long tr = n - 1) {
  push(v, tl, tr);
  if (tl >= l && tr <= r) return st[v];
  long long mid = (tl + tr) / 2;
  pair<long long, long long> r1 = pair<long long, long long>(-oo, -oo),
                             r2 = pair<long long, long long>(-oo, -oo);
  if (l > r) return r1;
  if (mid >= l) r1 = qry(l, r, v * 2, tl, mid);
  if (mid < r) r2 = qry(l, r, v * 2 + 1, mid + 1, tr);
  return max(r1, r2);
}
void solve() {
  long long ttl = 0, ans = -1, ansl = -1, ansr = -1;
  cin >> ttl;
  for (long long i = 0; i < ttl; i++) {
    cin >> ara[i].first.first >> ara[i].first.second >> ara[i].second;
    vals.push_back(ara[i].first.first);
    vals.push_back(ara[i].first.second);
  }
  sort(vals.begin(), vals.end());
  vals.push_back(vals.back() + 1);
  n = unique(vals.begin(), vals.end()) - vals.begin();
  vals.resize(n);
  build();
  for (long long i = 0; i < ttl; i++) {
    long long l = lower_bound(vals.begin(), vals.end(),
                              min(ara[i].first.first, ara[i].first.second)) -
                  vals.begin();
    long long r = lower_bound(vals.begin(), vals.end(),
                              max(ara[i].first.first, ara[i].first.second)) -
                  vals.begin();
    others[l].push_back(pair<long long, long long>(r, ara[i].second));
  }
  for (long long l = n - 1; l >= 0; l--) {
    for (pair<long long, long long> p : others[l]) {
      long long cr = p.first;
      upd(cr, n - 1, p.second);
    }
    pair<long long, long long> cans = qry(l, n - 1);
    if (vals[l] + cans.first > ans) {
      ans = cans.first + vals[l];
      ansl = vals[l];
      ansr = vals[cans.second];
    }
  }
  cout << ans << endl
       << ansl << " " << ansl << " " << ansr << " " << ansr << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}