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;
namespace zyt {
const int N = 5e5 + 10;
int n, w[N], tmp[N << 1], cnt;
vector<int> v[N << 1];
pair<int, int> arr[N];
namespace Segment_Tree {
struct node {
  pair<long long, int> mx;
  long long tag;
} tree[N << 3];
void update(const int rot) {
  tree[rot].mx = max(tree[rot << 1].mx, tree[rot << 1 | 1].mx);
}
void add(const int rot, const long long x) {
  tree[rot].mx.first += x;
  tree[rot].tag += x;
}
void pushdown(const int rot) {
  if (tree[rot].tag) {
    add(rot << 1, tree[rot].tag);
    add(rot << 1 | 1, tree[rot].tag);
    tree[rot].tag = 0;
  }
}
void build(const int rot, const int lt, const int rt) {
  tree[rot].tag = 0;
  if (lt == rt) {
    tree[rot].mx.first = -tmp[lt];
    tree[rot].mx.second = tmp[lt];
    return;
  }
  int mid = (lt + rt) >> 1;
  build(rot << 1, lt, mid);
  build(rot << 1 | 1, mid + 1, rt);
  update(rot);
}
void add(const int rot, const int lt, const int rt, const int ls, const int rs,
         const long long x) {
  if (ls <= lt && rt <= rs) return void(add(rot, x));
  int mid = (lt + rt) >> 1;
  pushdown(rot);
  if (ls <= mid) add(rot << 1, lt, mid, ls, rs, x);
  if (rs > mid) add(rot << 1 | 1, mid + 1, rt, ls, rs, x);
  update(rot);
}
pair<long long, int> query(const int rot, const int lt, const int rt,
                           const int ls, const int rs) {
  if (ls <= lt && rt <= rs) return tree[rot].mx;
  int mid = (lt + rt) >> 1;
  pushdown(rot);
  if (rs <= mid)
    return query(rot << 1, lt, mid, ls, rs);
  else if (ls > mid)
    return query(rot << 1 | 1, mid + 1, rt, ls, rs);
  else
    return max(query(rot << 1, lt, mid, ls, rs),
               query(rot << 1 | 1, mid + 1, rt, ls, rs));
}
}  // namespace Segment_Tree
int work() {
  using namespace Segment_Tree;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &arr[i].first, &arr[i].second, &w[i]);
    if (arr[i].first > arr[i].second) swap(arr[i].first, arr[i].second);
    tmp[++cnt] = arr[i].first, tmp[++cnt] = arr[i].second;
  }
  sort(tmp + 1, tmp + cnt + 1);
  cnt = unique(tmp + 1, tmp + cnt + 1) - tmp - 1;
  for (int i = 1; i <= n; i++) {
    arr[i].first = lower_bound(tmp + 1, tmp + cnt + 1, arr[i].first) - tmp;
    arr[i].second = lower_bound(tmp + 1, tmp + cnt + 1, arr[i].second) - tmp;
    v[arr[i].first].push_back(i);
  }
  build(1, 1, cnt);
  long long ans = 0;
  int l = 2e9, r = 2e9;
  for (int i = cnt; i > 0; i--) {
    for (vector<int>::iterator it = v[i].begin(); it != v[i].end(); it++)
      add(1, 1, cnt, arr[*it].second, cnt, w[*it]);
    pair<long long, int> now = query(1, 1, cnt, i, cnt);
    now.first += tmp[i];
    if (now.first > ans) ans = now.first, l = tmp[i], r = now.second;
  }
  printf("%lld\n%d %d %d %d", ans, l, l, r, r);
  return 0;
}
}  // namespace zyt
int main() { return zyt::work(); }