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;
int n;
pair<pair<int, int>, long long> arr[500010];
vector<int> val;
vector<pair<int, int> > segs[1000010];
pair<long long, int> tr[4000010];
long long laz[4000010];
void build(int l, int r, int o) {
  if (l == r) {
    tr[o] = make_pair(-val[l], l);
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, (o << 1));
  build(mid + 1, r, ((o << 1) | 1));
  tr[o] = max(tr[(o << 1)], tr[((o << 1) | 1)]);
}
void pushdown(int o) {
  if (laz[o]) {
    tr[(o << 1)].first += laz[o], tr[((o << 1) | 1)].first += laz[o];
    laz[(o << 1)] += laz[o], laz[((o << 1) | 1)] += laz[o];
    laz[o] = 0;
  }
}
void modify(int L, int R, long long v, int l, int r, int o) {
  if (l >= L && r <= R) {
    laz[o] += v, tr[o].first += v;
    return;
  }
  pushdown(o);
  int mid = l + r >> 1;
  if (L <= mid) modify(L, R, v, l, mid, (o << 1));
  if (R > mid) modify(L, R, v, mid + 1, r, ((o << 1) | 1));
  tr[o] = max(tr[(o << 1)], tr[((o << 1) | 1)]);
}
pair<long long, int> query(int L, int R, int l, int r, int o) {
  if (l >= L && r <= R) return tr[o];
  pushdown(o);
  pair<long long, int> ret = make_pair((long long)(-1e18), 0);
  int mid = l + r >> 1;
  if (L <= mid) ret = max(ret, query(L, R, l, mid, (o << 1)));
  if (R > mid) ret = max(ret, query(L, R, mid + 1, r, ((o << 1) | 1)));
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second;
  val.push_back(0);
  for (int i = 1; i <= n; i++) {
    val.push_back(arr[i].first.first);
    val.push_back(arr[i].first.second);
  }
  sort(val.begin(), val.end());
  val.push_back(val.back() + 1);
  val.resize(unique(val.begin(), val.end()) - val.begin());
  for (int i = 1; i <= n; i++) {
    int l = lower_bound(val.begin(), val.end(), arr[i].first.first) -
            val.begin(),
        r = lower_bound(val.begin(), val.end(), arr[i].first.second) -
            val.begin();
    if (l > r) swap(l, r);
    segs[l].push_back(make_pair(r, arr[i].second));
  }
  n = val.size();
  build(0, n - 1, 1);
  long long ans = -1;
  int L, R;
  for (int i = val.size() - 1; i >= 0; i--) {
    for (auto v : segs[i]) modify(v.first, n - 1, v.second, 0, n - 1, 1);
    auto tmp = query(i, n - 1, 0, n - 1, 1);
    if (tmp.first + val[i] > ans) {
      ans = tmp.first + val[i];
      L = val[i], R = val[tmp.second];
    }
  }
  cout << ans << endl << L << ' ' << L << ' ' << R << ' ' << R << endl;
  return 0;
}