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 xx[1000005], yy[1000005], cc[1000005];
vector<pair<int, int> > vec[1000005];
set<int> se;
map<int, int> ma;
int inv[1000005];
struct segTree {
  int n;
  vector<pair<long long, int> > tree;
  vector<long long> lazy;
  segTree(int n) : n(n), tree(4 * n, {0, 0}), lazy(4 * n, 0) {}
  void treeSetup(int node, int l, int r) {
    if (l == r) {
      tree[node].second = l;
      return;
    }
    int mid = (l + r) >> 1;
    treeSetup(2 * node, l, mid);
    treeSetup(2 * node + 1, mid + 1, r);
    tree[node] = max(tree[2 * node], tree[2 * node + 1]);
  }
  void setup() { treeSetup(1, 1, n); }
  void propagate(int node, int l, int r) {
    tree[node].first += lazy[node];
    if (l != r) lazy[2 * node] += lazy[node], lazy[2 * node + 1] += lazy[node];
    lazy[node] = 0;
  }
  void treeUpdate(int node, int l, int r, int u, int v, long long val) {
    int mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l > v || r < u) return;
    if (l >= u && r <= v) {
      lazy[node] += val;
      propagate(node, l, r);
      return;
    }
    treeUpdate(2 * node, l, mid, u, v, val);
    treeUpdate(2 * node + 1, mid + 1, r, u, v, val);
    tree[node] = max(tree[2 * node], tree[2 * node + 1]);
  }
  void update(int l, int r, long long val) { treeUpdate(1, 1, n, l, r, val); }
  pair<long long, int> treeQuery(int node, int l, int r, int u, int v) {
    int mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l > v || r < u) return {-1, -1};
    if (l >= u && r <= v) return tree[node];
    return max(treeQuery(2 * node, l, mid, u, v),
               treeQuery(2 * node + 1, mid + 1, r, u, v));
  }
  pair<long long, int> query(int l, int r) { return treeQuery(1, 1, n, l, r); }
};
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d", xx + i, yy + i, cc + i);
    se.insert(xx[i]);
    se.insert(yy[i]);
  }
  int tot = 0;
  for (int x : se) {
    ma[x] = ++tot;
    inv[tot] = x;
  }
  for (int i = 1; i <= n; i++) {
    int x = min(xx[i], yy[i]), y = max(xx[i], yy[i]);
    x = ma[x], y = ma[y];
    int c = cc[i];
    vec[x].push_back({y, c});
  }
  segTree tree(tot);
  tree.setup();
  long long ans = 0;
  int ansx = 2000000000, ansy = 2000000000;
  for (int i = tot; i; i--) {
    for (pair<int, int> p : vec[i]) {
      int r = p.first, c = p.second;
      tree.update(r, tot, c);
    }
    pair<long long, int> tmp = tree.query(i, tot);
    if (tmp.first > ans) ans = tmp.first, ansx = inv[i], ansy = inv[tmp.second];
    tree.update(i, tot, inv[i - 1] - inv[i]);
  }
  printf("%lld\n", ans);
  printf("%d %d %d %d\n", ansx, ansx, ansy, ansy);
  return 0;
}