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;
template <typename U, typename V>
void Min(U &a, const V &b) {
  if (a > b) a = b;
}
template <typename U, typename V>
void Max(U &a, const V &b) {
  if (a < b) a = b;
}
template <typename U, typename V>
void add(U &a, const V &b) {
  a = (a + b) % 1000000007;
}
template <typename U>
U gcd(U a, U b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a >= b)
    return gcd(a % b, b);
  else
    return gcd(a, b % a);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 1000000007;
    a = 1LL * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
const long long INF = 1e18;
long long c[1000005 << 2];
pair<long long, int> mx[1000005 << 2];
void cal(int p, long long v) {
  mx[p].first += v;
  c[p] += v;
}
void down(int p) {
  if (c[p]) {
    cal(p << 1, c[p]);
    cal(p << 1 | 1, c[p]);
    c[p] = 0;
  }
}
void build(int p, int l, int r) {
  if (l == r) {
    mx[p] = {0, l};
    return;
  }
  int m = (l + r) >> 1;
  build(p << 1, l, m);
  build(p << 1 | 1, m + 1, r);
  mx[p] = max(mx[p << 1], mx[p << 1 | 1]);
}
void upd(int p, int l, int r, int first, int second, int v) {
  if (l >= first && r <= second) {
    cal(p, v);
    return;
  }
  down(p);
  int m = (l + r) >> 1;
  if (first <= m) upd(p << 1, l, m, first, second, v);
  if (second > m) upd(p << 1 | 1, m + 1, r, first, second, v);
  mx[p] = max(mx[p << 1], mx[p << 1 | 1]);
}
pair<long long, int> query(int p, int l, int r, int first, int second) {
  if (l >= first && r <= second) return mx[p];
  down(p);
  int m = (l + r) >> 1;
  pair<long long, int> ans = {-INF, 0};
  if (first <= m) ans = query(p << 1, l, m, first, second);
  if (second > m) ans = max(ans, query(p << 1 | 1, m + 1, r, first, second));
  return ans;
}
struct node {
  int first, second, w;
} a[1000005 / 2];
int v[1000005], sz;
vector<pair<int, int> > q[1000005];
int main() {
  int T, m, n, i, j, k, K;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d", &j, &k, &K);
    v[sz++] = j, v[sz++] = k;
    a[i] = {j, k, K};
  }
  sort(v, v + sz);
  sz = unique(v, v + sz) - v;
  for (int i = 0; i < n; i++) {
    j = lower_bound(v, v + sz, a[i].first) - v;
    k = lower_bound(v, v + sz, a[i].second) - v;
    if (j < k) {
      q[k].push_back({j, a[i].w});
    } else {
      q[j].push_back({k, a[i].w});
    }
  }
  build(1, 0, sz - 1);
  pair<long long, int> w;
  long long res = 0;
  pair<int, int> ans(1000005, 1000005);
  for (int i = 0; i < sz; i++) {
    upd(1, 0, sz - 1, i, i, v[i]);
    for (auto &o : q[i]) {
      upd(1, 0, sz - 1, 0, o.first, o.second);
    }
    w = query(1, 0, sz - 1, 0, i);
    w.first -= v[i];
    if (w.first > res) res = w.first, ans = {v[w.second], v[i]};
  }
  printf("%lld\n", res);
  printf("%d %d %d %d\n", ans.first, ans.first, ans.second, ans.second);
}