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>
#pragma GCC optimize("O2")
using namespace std;
vector<long long> tree, mxi, tag, a;
int T;
void push(int i, int l, int r) {
  if (tag[i]) {
    tree[i] += tag[i];
    if (l != r) {
      tag[((i << 1) + 1)] += tag[i];
      tag[((i << 1) + 2)] += tag[i];
    }
    tag[i] = 0;
  }
}
void pull(int i, int l, int r) {
  if (tree[((i << 1) + 1)] + tag[((i << 1) + 1)] >=
      tree[((i << 1) + 2)] + tag[((i << 1) + 2)]) {
    tree[i] = tree[((i << 1) + 1)] + tag[((i << 1) + 1)];
    mxi[i] = mxi[((i << 1) + 1)];
  } else {
    tree[i] = tree[((i << 1) + 2)] + tag[((i << 1) + 2)];
    mxi[i] = mxi[((i << 1) + 2)];
  }
}
void build(int i, int l, int r) {
  if (l == r) {
    tree[i] = a[l];
    mxi[i] = l;
    return;
  }
  int m = (l + r) >> 1;
  build(((i << 1) + 1), l, m);
  build(((i << 1) + 2), m + 1, r);
  pull(i, l, r);
}
int ql, qr, x;
long long v;
void update(int i, int l, int r) {
  if (ql <= l && r <= qr) {
    tag[i] += v;
    return;
  }
  int m = (l + r) >> 1;
  if (ql <= m) update(((i << 1) + 1), l, m);
  if (qr > m) update(((i << 1) + 2), m + 1, r);
  pull(i, l, r);
}
void query(int i, int l, int r) {
  push(i, l, r);
  if (ql <= l && r <= qr) {
    if (tree[i] > v) {
      v = tree[i];
      x = mxi[i];
    }
    return;
  }
  int m = (l + r) >> 1;
  if (ql <= m) query(((i << 1) + 1), l, m);
  if (qr > m) query(((i << 1) + 2), m + 1, r);
}
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<tuple<long long, long long, long long>> arr(n);
  vector<long long> all(n);
  for (int i = 0; i < n; i++) {
    long long l, r, c;
    cin >> l >> r >> c;
    if (l > r) swap(l, r);
    arr[i] = tie(l, r, c);
    all[i] = r;
  }
  sort(arr.begin(), arr.end());
  sort(all.begin(), all.end());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  T = all.size();
  a.resize(T, 0);
  for (int i = 0; i < n; i++) {
    get<1>(arr[i]) =
        lower_bound(all.begin(), all.end(), get<1>(arr[i])) - all.begin();
    a[get<1>(arr[i])] += get<2>(arr[i]);
  }
  for (int i = 1; i < T; i++) a[i] += a[i - 1];
  for (int i = 0; i < T; i++) a[i] -= all[i];
  tree.resize(T * 4);
  tag.resize(T * 4, 0);
  mxi.resize(T * 4);
  build(0, 0, T - 1);
  long long ans = 0;
  int l = 1.5e9, r = l;
  for (int i = 0; i < n;) {
    int j = i + 1;
    while (j < n && get<0>(arr[i]) == get<0>(arr[j])) j++;
    for (int k = i; k < j; k++) {
      ql = lower_bound(all.begin(), all.end(), get<0>(arr[k])) - all.begin();
      qr = T - 1;
      v = -1e9;
      query(0, 0, T - 1);
      if (v + get<0>(arr[k]) > ans) {
        ans = v + get<0>(arr[k]);
        l = get<0>(arr[k]);
        r = all[x];
      }
    }
    for (int k = i; k < j; k++) {
      ql = get<1>(arr[k]);
      qr = T - 1;
      v = -get<2>(arr[k]);
      update(0, 0, T - 1);
    }
    i = j;
  }
  cout << ans << "\n";
  cout << l << " " << l << " " << r << " " << r << "\n";
  return 0;
}