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 T>
class LazySegmentTree {
 public:
  LazySegmentTree(int sz, const vector<T>& v) : n(sz) {
    tree.resize(n << 2);
    lazy.resize(n << 2);
    build(0, n - 1, 1, v);
  }
  void add(int L, int R, T val) { add(0, n - 1, 1, L, R, val); }
  pair<T, int> getMax(int L, int R) { return getMax(0, n - 1, 1, L, R); }
  void print() {
    print(0, n - 1, 1);
    cout << "\n\n";
  }

 private:
  void print(int low, int high, int pos) {
    push(low, high, pos);
    if (low == high) {
      cout << tree[pos].first << " ";
      return;
    }
    int mid = (low + high) >> 1;
    print(low, mid, pos << 1);
    print(mid + 1, high, pos << 1 | 1);
  }
  void build(int low, int high, int pos, const vector<T>& v) {
    if (low == high) {
      tree[pos] = {v[low], low};
      return;
    }
    int mid = (low + high) >> 1;
    build(low, mid, pos << 1, v);
    build(mid + 1, high, pos << 1 | 1, v);
    tree[pos] = max(tree[pos << 1], tree[pos << 1 | 1]);
  }
  void push(int low, int high, int pos) {
    tree[pos].first += lazy[pos];
    if (low != high) {
      lazy[pos << 1] += lazy[pos];
      lazy[pos << 1 | 1] += lazy[pos];
    }
    lazy[pos] = 0;
  }
  void add(int low, int high, int pos, int L, int R, T val) {
    push(low, high, pos);
    if (L > high || R < low) {
      return;
    }
    if (L <= low && R >= high) {
      lazy[pos] += val;
      push(low, high, pos);
      return;
    }
    int mid = (low + high) >> 1;
    add(low, mid, pos << 1, L, R, val);
    add(mid + 1, high, pos << 1 | 1, L, R, val);
    tree[pos] = max(tree[pos << 1], tree[pos << 1 | 1]);
  }
  pair<T, int> getMax(int low, int high, int pos, int L, int R) {
    push(low, high, pos);
    if (L > high || R < low) {
      return make_pair(INT_MIN, -1);
    }
    if (L <= low && R >= high) {
      return tree[pos];
    }
    int mid = (low + high) >> 1;
    return max(getMax(low, mid, pos << 1, L, R),
               getMax(mid + 1, high, pos << 1 | 1, L, R));
  }
  int n;
  vector<pair<T, int> > tree;
  vector<T> lazy;
};
int main() {
  int n;
  cin >> n;
  vector<int> lines;
  vector<int> x(n);
  vector<int> y(n);
  vector<int> c(n);
  multiset<pair<pair<int, int>, int> > pointsByX, pointsByY;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i] >> c[i];
    lines.push_back(x[i]);
    lines.push_back(y[i]);
    pointsByX.insert({{x[i], y[i]}, i});
    pointsByY.insert({{y[i], x[i]}, i});
  }
  sort(lines.begin(), lines.end());
  lines.erase(unique(lines.begin(), lines.end()), lines.end());
  auto erasePoint = [&](int x, int y) {
    auto it1 = pointsByX.lower_bound({{x, y}, INT_MIN});
    assert(it1 != pointsByX.end());
    pointsByX.erase(it1);
    auto it2 = pointsByY.lower_bound({{y, x}, INT_MIN});
    assert(it2 != pointsByY.end());
    pointsByY.erase(it2);
  };
  vector<vector<int> > linePoints(lines.size());
  vector<int> pointLine(n);
  for (int i = 0; i < n; ++i) {
    int line = lower_bound(lines.begin(), lines.end(), max(x[i], y[i])) -
               lines.begin();
    linePoints[line].push_back(i);
    pointLine[i] = line;
  }
  vector<long long> cost(lines.size());
  long long sum = 0;
  for (int i = 0; i < lines.size(); ++i) {
    for (int j = 0; j < linePoints[i].size(); ++j) {
      int pointIndex = linePoints[i][j];
      sum += c[pointIndex];
    }
    cost[i] = sum - lines[i];
  }
  LazySegmentTree<long long> tree(lines.size(), cost);
  long long answer = 0;
  int L = 2e9 - 1;
  int R = 2e9 - 1;
  for (int i = 0; i < lines.size(); ++i) {
    while (!pointsByX.empty() && pointsByX.begin()->first.first < lines[i]) {
      pair<pair<int, int>, int> point = *pointsByX.begin();
      int pointIndex = point.second;
      tree.add(pointLine[pointIndex], lines.size() - 1, -c[pointIndex]);
      erasePoint(point.first.first, point.first.second);
    }
    while (!pointsByY.empty() && pointsByY.begin()->first.first < lines[i]) {
      pair<pair<int, int>, int> point = *pointsByY.begin();
      int pointIndex = point.second;
      tree.add(pointLine[pointIndex], lines.size() - 1, -c[pointIndex]);
      erasePoint(point.first.second, point.first.first);
    }
    pair<long long, int> can = tree.getMax(i, lines.size() - 1);
    can.first += lines[i];
    if (can.first > answer) {
      answer = can.first;
      L = lines[i];
      R = lines[can.second];
    }
  }
  cout << answer << "\n" << L << " " << L << " " << R << " " << R;
  return 0;
}