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;
const int MAXN = 1000005;
const long long MOD = 1000000007;
const long long INF = (long long)1e9 + 5;
struct Point {
  long long x, y, c;
};
struct Change {
  long long pos, c;
};
struct ST {
  long long maxv[4 * MAXN], add[4 * MAXN], where[4 * MAXN];
  void pull(long long idx) {
    if (maxv[idx << 1] > maxv[idx << 1 | 1]) {
      where[idx] = where[idx << 1];
    } else {
      where[idx] = where[idx << 1 | 1];
    }
    maxv[idx] = max(maxv[idx << 1], maxv[idx << 1 | 1]) + add[idx];
  }
  void init(long long l, long long r, long long idx) {
    if (l == r) {
      where[idx] = l;
      return;
    }
    long long m = (l + r) >> 1;
    init(l, m, idx << 1);
    init(m + 1, r, idx << 1 | 1);
    pull(idx);
  }
  void rng_add(long long ql, long long qr, long long v, long long l,
               long long r, long long idx) {
    if (ql <= l && r <= qr) {
      add[idx] += v;
      maxv[idx] += v;
      return;
    }
    long long m = (l + r) >> 1;
    if (ql <= m) rng_add(ql, qr, v, l, m, idx << 1);
    if (qr > m) rng_add(ql, qr, v, m + 1, r, idx << 1 | 1);
    pull(idx);
  }
  pair<long long, long long> rmq(long long ql, long long qr, long long l,
                                 long long r, long long idx) {
    if (ql <= l && r <= qr) return {maxv[idx], where[idx]};
    long long m = (l + r) >> 1;
    pair<long long, long long> res = {-1e18, -111};
    if (ql <= m) {
      auto q = rmq(ql, qr, l, m, idx << 1);
      res = max(res, pair<long long, long long>{q.first + add[idx], q.second});
    }
    if (qr > m) {
      auto q = rmq(ql, qr, m + 1, r, idx << 1 | 1);
      res = max(res, pair<long long, long long>{q.first + add[idx], q.second});
    }
    return res;
  }
} tree;
long long N;
vector<long long> occ;
vector<Change> chg[MAXN];
vector<Point> mod;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long x, y, c;
    cin >> x >> y >> c;
    mod.push_back({x, y, c});
    occ.push_back(x);
    occ.push_back(y);
  }
  sort(occ.begin(), occ.end());
  occ.resize(unique(occ.begin(), occ.end()) - occ.begin());
  for (Point &p : mod) {
    p.x = lower_bound(occ.begin(), occ.end(), p.x) - occ.begin() + 1;
    p.y = lower_bound(occ.begin(), occ.end(), p.y) - occ.begin() + 1;
    if (p.x >= p.y) {
      chg[p.x].push_back({p.y, p.c});
    } else {
      chg[p.y].push_back({p.x, p.c});
    }
  }
  long long M = occ.size();
  long long ans = 0;
  pair<long long, long long> ch = {(long long)1e9 + 5, (long long)1e9 + 5};
  tree.init(1, M, 1);
  for (long long i = 1; i <= occ.size(); i++) {
    tree.rng_add(i, i, occ[i - 1], 1, M, 1);
    for (Change &x : chg[i]) {
      tree.rng_add(1, x.pos, x.c, 1, M, 1);
    }
    auto opt = tree.rmq(1, i, 1, M, 1);
    if (ans < opt.first - occ[i - 1]) {
      ans = opt.first - occ[i - 1];
      ch = {occ[i - 1], occ[opt.second - 1]};
    }
  }
  cout << ans << '\n';
  cout << ch.second << " " << ch.second << " " << ch.first << " " << ch.first
       << '\n';
  return 0;
}