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 int maxN = 5e5 + 10, INF = 1e16;
long long int n, cnt = 0, ans = 0, x, y, c, ll = 2e9, rr = 2e9;
long long int seg[maxN << 2], tag[maxN << 2], maxFrom[maxN << 2];
vector<tuple<long long int, long long int, long long int> > vec;
vector<long long int> lismin;
inline void pull(long long int id) {
  if (seg[2 * id + 1] >= seg[2 * id + 2]) {
    maxFrom[id] = maxFrom[2 * id + 1];
  } else {
    maxFrom[id] = maxFrom[2 * id + 2];
  }
  seg[id] = max(seg[2 * id + 1], seg[2 * id + 2]);
}
void build(long long int id, long long int l, long long int r) {
  seg[id] = 0;
  if (l + 1 == r) {
    maxFrom[id] = lismin[l];
    return;
  }
  long long int m = (l + r) / 2;
  build(2 * id + 1, l, m);
  build(2 * id + 2, m, r);
  pull(id);
}
inline void push(long long int id, long long int l, long long int r) {
  seg[id] += tag[id];
  if (l + 1 < r) {
    tag[2 * id + 1] += tag[id];
    tag[2 * id + 2] += tag[id];
  }
  tag[id] = 0;
}
void modify(long long int id, long long int ql, long long int qr,
            long long int l, long long int r, long long int v) {
  push(id, l, r);
  if (qr <= l || ql >= r) return;
  if (ql <= l && r <= qr) {
    tag[id] += v;
    push(id, l, r);
    return;
  }
  long long int m = (l + r) / 2;
  modify(2 * id + 1, ql, qr, l, m, v);
  modify(2 * id + 2, ql, qr, m, r, v);
  pull(id);
}
pair<long long int, long long int> query(long long int id, long long int ql,
                                         long long int qr, long long int l,
                                         long long int r) {
  push(id, l, r);
  if (qr <= l || ql >= r) return pair<long long int, long long int>(-INF, -1);
  if (ql <= l && r <= qr)
    return pair<long long int, long long int>(seg[id], maxFrom[id]);
  long long int m = (l + r) / 2;
  pair<long long int, long long int> a, b;
  return max(query(2 * id + 1, ql, qr, l, m), query(2 * id + 2, ql, qr, m, r));
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n;
  vec.resize(n);
  for (long long int i = 0; i < n; i++) {
    cin >> x >> y >> c;
    if (x < y) swap(x, y);
    vec[i] = make_tuple(x, y, c);
    lismin.push_back(y);
  }
  sort(lismin.begin(), lismin.end());
  long long int minsz = unique(lismin.begin(), lismin.end()) - lismin.begin();
  sort(vec.begin(), vec.end(),
       [](const tuple<long long int, long long int, long long int> a,
          const tuple<long long int, long long int, long long int> b) {
         return (get<0>(a) == get<0>(b)) ? get<1>(a) < get<1>(b)
                                         : get<0>(a) < get<0>(b);
       });
  long long int cm, re;
  bool modified[minsz + 10];
  pair<long long int, long long int> res;
  build(0, 0, minsz);
  fill(modified, modified + minsz + 5, false);
  for (long long int i = 0; i < n; i++) {
    cm = get<0>(vec[i]);
    re = upper_bound(lismin.begin(), lismin.begin() + minsz, get<1>(vec[i])) -
         lismin.begin();
    modify(0, 0, re, 0, minsz, get<2>(vec[i]));
    if (!modified[re - 1]) {
      modify(0, re - 1, re, 0, minsz, get<1>(vec[i]));
      modified[re - 1] = true;
    }
    if (i < n - 1 && get<0>(vec[i]) == get<0>(vec[i + 1])) continue;
    res = query(0, 0, re, 0, minsz);
    if (ans < res.first - get<0>(vec[i])) {
      ans = res.first - get<0>(vec[i]);
      ll = res.second;
      rr = get<0>(vec[i]);
    }
  }
  cout << ans << endl;
  cout << ll << " " << ll << " " << rr << " " << rr << endl;
}