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;
struct node {
  node *l, *r;
  long long Max;
  long long Maxi;
  long long tag;
  node() : l(NULL), r(NULL), Max(0) { tag = 0; }
} * root;
void push(node *n) {
  n->l->tag += n->tag;
  n->r->tag += n->tag;
  n->tag = 0;
}
long long Max(node *n) { return n->Max + n->tag; }
void pull(node *n) {
  if (Max(n->l) > Max(n->r)) {
    n->Max = Max(n->l);
    n->Maxi = n->l->Maxi;
  } else {
    n->Max = Max(n->r);
    n->Maxi = n->r->Maxi;
  }
}
void build(node *n, int L, int R, int *a) {
  if (L == R) {
    n->Max = a[L];
    n->Maxi = L;
    return;
  }
  int mid = (L + R) / 2;
  n->l = new node();
  n->r = new node();
  build(n->l, L, mid, a);
  build(n->r, mid + 1, R, a);
  pull(n);
}
void add(node *n, int L, int R, int l, int r, int k) {
  if (L >= l && R <= r) {
    n->tag += k;
    return;
  }
  if (R < l || L > r) return;
  push(n);
  int mid = (L + R) / 2;
  add(n->l, L, mid, l, r, k);
  add(n->r, mid + 1, R, l, r, k);
  pull(n);
}
pair<long long, long long> query(node *n, int L, int R, int l, int r) {
  if (L >= l && R <= r) {
    return make_pair(Max(n), n->Maxi);
  }
  if (R < l || L > r) return make_pair(-1e18, -1e18);
  push(n);
  int mid = (L + R) / 2;
  pair<long long, long long> res =
      max(query(n->l, L, mid, l, r), query(n->r, mid + 1, R, l, r));
  pull(n);
  return res;
}
pair<pair<int, int>, int> p[500005];
int a[500005];
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int first, second, c;
    scanf("%d %d %d", &first, &second, &c);
    if (first < second) swap(first, second);
    p[i] = make_pair(make_pair(first, second), c);
    m[second];
  }
  int index = 0;
  for (auto &it : m) {
    it.second = ++index;
    a[index] = it.first;
  }
  sort(p, p + n);
  root = new node();
  build(root, 1, index, a);
  long long ans = 0;
  long long al = 1e9 + 7, ar = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    add(root, 1, index, 1, m[p[i].first.second], p[i].second);
    if (i == n - 1 || p[i].first.first != p[i + 1].first.first) {
      pair<long long, long long> res = query(
          root, 1, index, 1, prev(m.upper_bound(p[i].first.first))->second);
      res.first -= p[i].first.first;
      if (res.first > ans) {
        ans = res.first;
        al = a[res.second];
        ar = p[i].first.first;
      }
    }
  }
  printf("%lld\n%lld %lld %lld %lld\n", ans, al, al, ar, ar);
  return 0;
}