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 fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int MAXN = 5e5 + 10, P = 2 * MAXN;
const long long int INF = 1e15 + 42;
map<long long int, long long int> compress;
long long int x[MAXN], y[MAXN], c[MAXN], rev[P];
vector<pair<long long int, long long int>> at[P];
pair<long long int, long long int> seg[4 * P];
long long int lazy[4 * P];
void build(long long int node, long long int second, long long int e) {
  if (second > e) return;
  if (second == e) {
    seg[node] = {0, second};
    return;
  }
  long long int mid = (second + e) >> 1;
  build(2 * node, second, mid);
  build(2 * node + 1, mid + 1, e);
  seg[node] = max(seg[2 * node], seg[2 * node + 1]);
}
void propogate(long long int node, long long int second, long long int e) {
  seg[node].first += lazy[node];
  if (second != e) {
    lazy[2 * node] += lazy[node];
    lazy[2 * node + 1] += lazy[node];
  }
  lazy[node] = 0;
}
void update(long long int node, long long int second, long long int e,
            long long int qs, long long int qe, long long int val) {
  propogate(node, second, e);
  if (second > e || qs > e || qe < second) return;
  if (qs <= second && e <= qe) {
    lazy[node] += val;
    propogate(node, second, e);
    return;
  }
  long long int mid = (second + e) >> 1;
  update(2 * node, second, mid, qs, qe, val);
  update(2 * node + 1, mid + 1, e, qs, qe, val);
  seg[node] = max(seg[2 * node], seg[2 * node + 1]);
}
pair<long long int, long long int> query(long long int node,
                                         long long int second, long long int e,
                                         long long int qs, long long int qe) {
  propogate(node, second, e);
  if (second > e || qs > e || qe < second) return {-INF, 0LL};
  if (qs <= second && e <= qe) return seg[node];
  long long int mid = (second + e) >> 1;
  return max(query(2 * node, second, mid, qs, qe),
             query(2 * node + 1, mid + 1, e, qs, qe));
}
void solve() {
  long long int n;
  cin >> n;
  for (long long int i = (1); i <= (n); ++i) {
    cin >> x[i] >> y[i] >> c[i];
    if (x[i] > y[i]) swap(x[i], y[i]);
    compress[x[i]];
    compress[y[i]];
  }
  long long int lid = 0;
  for (auto &i : compress) {
    i.second = ++lid;
    rev[i.second] = i.first;
  }
  for (long long int i = (1); i <= (n); ++i) {
    at[compress[x[i]]].push_back({compress[y[i]], c[i]});
  }
  long long int ans = 0;
  pair<long long int, long long int> pt = {2e9, 2e9};
  build(1, 1, lid);
  for (long long int i = (1); i <= (lid); ++i) {
    update(1, 1, lid, i, i, -rev[i]);
  }
  for (long long int x = (lid); x >= (1); --x) {
    for (auto p : at[x]) {
      long long int y = p.first, cost = p.second;
      update(1, 1, lid, y, lid, cost);
    }
    auto q = query(1, 1, lid, x, lid);
    if (q.first + rev[x] > ans) {
      ans = q.first + rev[x];
      pt = {rev[x], rev[q.second]};
    }
  }
  cout << ans << '\n';
  cout << pt.first << " " << pt.first << " " << pt.second << " " << pt.second
       << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  for (long long int i = (1); i <= (t); ++i) {
    solve();
  }
}