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;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
const long long INF = 1001001001001001001ll;
struct segtree {
  static const long long SEG = 1 << 20;
  vector<pair<long long, long long> > dat;
  vector<long long> put;
  segtree() : dat(SEG * 2), put(SEG * 2) {
    for (long long i = 0; i < SEG; i++) dat[i + SEG - 1].second = i;
    for (long long i = SEG - 2; i >= 0; i--)
      dat[i] = max(dat[i * 2 + 1], dat[i * 2 + 2]);
  }
  inline void push(long long k) {
    dat[k].first += put[k];
    if (k < SEG - 1) {
      put[k * 2 + 1] += put[k];
      put[k * 2 + 2] += put[k];
    }
    put[k] = 0;
  }
  void add(long long a, long long b, long long x, long long k = 0,
           long long l = 0, long long r = SEG) {
    push(k);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      put[k] += x;
      push(k);
      return;
    }
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2, (l + r) / 2, r);
    dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
  pair<long long, long long> query(long long a, long long b, long long k = 0,
                                   long long l = 0, long long r = SEG) {
    push(k);
    if (r <= a || b <= l) return pair<long long, long long>(-INF, -1);
    if (a <= l && r <= b) return dat[k];
    return max(query(a, b, k * 2 + 1, l, (l + r) / 2),
               query(a, b, k * 2 + 2, (l + r) / 2, r));
  }
};
long long N;
long long L[555555], R[555555], C[555555];
vector<long long> lis[1111111];
signed main() {
  scanf("%lld", &N);
  vector<long long> vs;
  for (long long i = 0; i < (N); i++) {
    scanf("%lld%lld%lld", &L[i], &R[i], &C[i]);
    if (L[i] > R[i]) swap(L[i], R[i]);
    vs.push_back(L[i]);
    vs.push_back(R[i]);
  }
  sort((vs).begin(), (vs).end());
  vs.erase(unique((vs).begin(), (vs).end()), vs.end());
  for (long long i = 0; i < (N); i++) {
    L[i] = lower_bound((vs).begin(), (vs).end(), L[i]) - vs.begin();
    R[i] = lower_bound((vs).begin(), (vs).end(), R[i]) - vs.begin();
    lis[L[i]].push_back(i);
  }
  segtree seg;
  for (long long i = 0; i < vs.size(); i++) {
    seg.add(i, i + 1, -vs[i]);
  }
  tuple<long long, long long, long long> ans(0, 1001001001, 1001001001);
  for (long long i = (long long)vs.size() - 1; i >= 0; i--) {
    for (auto j : lis[i]) {
      seg.add(R[j], vs.size(), C[j]);
    }
    pair<long long, long long> p = seg.query(i, vs.size());
    chmax(ans, make_tuple(p.first + vs[i], vs[i], vs[p.second]));
  }
  cout << get<0>(ans) << endl;
  cout << get<1>(ans) << " " << get<1>(ans) << " " << get<2>(ans) << " "
       << get<2>(ans) << endl;
  return 0;
}