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;
const long long N = 1e6 + 7, mod = 1e9 + 7;
vector<pair<pair<int, int>, int> > usuwanie;
vector<int> zap;
map<int, int> mapa;
int n;
int aa[N], bb[N], cc[N];
struct tree {
  struct node {
    long long p = -1e16;
    long long sum = 0;
    int x = -1;
  };
  int base;
  vector<node> t;
  tree() {
    base = (1ll << 22);
    t.resize(2 * base + 5);
  }
  void repair(long long v) {
    if (v < base) {
      if (t[2 * v].p < t[2 * v + 1].p + t[2 * v].sum) {
        t[v] = t[2 * v + 1];
        t[v].p = t[2 * v + 1].p + t[2 * v].sum;
      } else {
        t[v] = t[2 * v];
      }
      t[v].sum = t[v * 2].sum + t[v * 2 + 1].sum;
    }
  }
  void add(long long v, int w) {
    v = mapa[v];
    v += base;
    t[v].sum += w;
    t[v].p += w;
    while (v > 1) {
      repair(v);
      v /= 2;
    }
  }
  pair<long long, int> query(long long v) {
    long long dod = v;
    v = mapa[v];
    v += base;
    node re = t[v];
    while (v > 1) {
      if (v % 2 == 1) {
        v /= 2;
        continue;
      }
      if (re.p < re.sum + t[v + 1].p) {
        re.p = re.sum + t[v + 1].p;
        re.x = t[v + 1].x;
      }
      re.sum += t[v + 1].sum;
      v /= 2;
    }
    return make_pair(re.p + dod, re.x);
  }
};
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  tree tr;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    aa[i] = a;
    bb[i] = b;
    cc[i] = c;
    usuwanie.push_back(make_pair(make_pair(min(a, b), max(a, b)), -c));
    zap.push_back(a);
    zap.push_back(b);
  }
  sort(usuwanie.begin(), usuwanie.end());
  reverse(usuwanie.begin(), usuwanie.end());
  sort(zap.begin(), zap.end());
  zap.resize(distance(zap.begin(), unique(zap.begin(), zap.end())));
  for (int i = 0; i < zap.size(); i++) {
    mapa[zap[i]] = i;
    tr.t[i + tr.base].x = zap[i];
    tr.t[i + tr.base].p = -zap[i];
  }
  for (int i = 0; i < n; i++) {
    tr.add(max(aa[i], bb[i]), cc[i]);
  }
  pair<long long, pair<int, int> > ans = make_pair(0, make_pair(2e9, 2e9));
  for (auto x : zap) {
    while (!usuwanie.empty() && usuwanie.back().first.first < x) {
      tr.add(usuwanie.back().first.second, usuwanie.back().second);
      usuwanie.pop_back();
    }
    pair<long long, int> ret = tr.query(x);
    if (ret.first > ans.first) {
      ans = make_pair(ret.first, make_pair(x, ret.second));
    }
  }
  cout << ans.first << endl;
  cout << ans.second.first << " " << ans.second.first << " ";
  cout << ans.second.second << " " << ans.second.second << endl;
}