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>
const int N = 500010;
using namespace std;
int n;
int l[N];
int cost[N];
vector<int> L;
vector<pair<int, int> > R;
pair<long long, int> t[4 * N];
long long shit[4 * N];
void open(int x, int l, int r, int g) {
  if (l == r) {
    t[x] = {L[l], L[l]};
    return;
  }
  int m = (l + r) / 2;
  if (g <= m) {
    open(x * 2, l, m, g);
  } else {
    open(x * 2 + 1, m + 1, r, g);
  }
  t[x] = max(t[x * 2], t[x * 2 + 1]);
  t[x].first += shit[x];
}
void upd(int x, int l, int r, int tl, int tr, int y) {
  if (tl > tr) {
    return;
  } else if (l == tl && r == tr) {
    t[x].first += y;
    shit[x] += y;
    return;
  }
  int m = (l + r) / 2;
  upd(x * 2, l, m, tl, min(m, tr), y);
  upd(x * 2 + 1, m + 1, r, max(m + 1, tl), tr, y);
  t[x] = max(t[x * 2], t[x * 2 + 1]);
  t[x].first += shit[x];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1, x, y, l, r; i <= n; i++) {
    cin >> x >> y >> cost[i];
    l = min(x, y);
    r = max(x, y);
    ::l[i] = l;
    L.push_back(l);
    R.push_back({r, i});
  }
  sort(L.begin(), L.end());
  sort(R.begin(), R.end(), [&](pair<int, int> x, pair<int, int> y) {
    if (x.first < y.first) {
      return true;
    } else if (x.first > y.first) {
      return false;
    }
    return l[x.second] < l[y.second];
  });
  vector<int> nv;
  for (int x : L) {
    if (nv.empty() || nv.back() != x) {
      nv.push_back(x);
    }
  }
  L = nv;
  long long best = 0;
  pair<int, int> res = {(int)2e9, (int)2e9};
  for (int i = 0; i < 4 * N; i++) {
    t[i] = {-1e18, -1e18};
  }
  int h = 0;
  for (int i = 0; i < R.size(); i++) {
    auto x = R[i];
    while (h < L.size() && L[h] <= x.first) {
      open(1, 0, L.size() - 1, h);
      h += 1;
    }
    int in = lower_bound(L.begin(), L.end(), l[x.second]) - L.begin();
    upd(1, 0, L.size() - 1, 0, in, cost[x.second]);
    if (i + 1 < R.size() && x.first == R[i + 1].first) {
      continue;
    }
    if (t[1].first - x.first > best) {
      best = t[1].first - x.first;
      res = {t[1].second, x.first};
    }
  }
  cout << best << "\n";
  cout << res.first << " " << res.first << " " << res.second << " "
       << res.second << "\n";
}