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 double eps = 1e-9;
const double pi = acos(-1.0);
const double dinf = 1e250;
const long long INF = (long long)(2e18);
const long long inf = (long long)(1e9 + 7);
vector<long long> x;
struct stree {
  vector<pair<long long, long long>> t;
  vector<long long> p;
  long long n = 1;
  stree() {}
  stree(vector<long long>& s) {
    while (n < s.size()) n *= 2;
    t.resize(2 * n, {-INF, -1});
    p.resize(2 * n, 0);
    for (long long i = 0; i < s.size(); ++i) t[i + n] = {-s[i], i};
    for (long long i = n - 1; i; --i) t[i] = max(t[2 * i], t[2 * i + 1]);
  }
  void push(long long v) {
    t[v].first += p[v];
    if (v < n) {
      p[2 * v] += p[v];
      p[2 * v + 1] += p[v];
    }
    p[v] = 0;
  }
  void set(long long l, long long r, long long x, long long v = 1,
           long long tl = 0, long long tr = -1) {
    if (tr == -1) tr = n;
    push(v);
    if (tl == l && tr == r) return void(p[v] += x);
    long long mid = (tl + tr) / 2;
    if (l < mid) set(l, min(mid, r), x, 2 * v, tl, mid);
    if (r > mid) set(max(mid, l), r, x, 2 * v + 1, mid, tr);
    push(2 * v);
    push(2 * v + 1);
    t[v] = max(t[2 * v], t[2 * v + 1]);
  }
  pair<long long, long long> get(long long l, long long r, long long v = 1,
                                 long long tl = 0, long long tr = -1) {
    if (tr == -1) tr = n;
    push(v);
    if (tl == l && tr == r) return t[v];
    pair<long long, long long> res = {-INF, -1};
    long long mid = (tl + tr) / 2;
    if (l < mid) res = max(res, get(l, min(mid, r), 2 * v, tl, mid));
    if (r > mid) res = max(res, get(max(l, mid), r, 2 * v + 1, mid, tr));
    return res;
  }
};
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cin.tie(0);
  long long n;
  cin >> n;
  set<pair<long long, long long>> s;
  vector<array<long long, 3>> ptr(n);
  for (auto& it : ptr) cin >> it[0] >> it[1] >> it[2];
  for (auto& it : ptr) s.insert({it[0], it[1]});
  for (auto& it : ptr) it = {min(it[0], it[1]), max(it[0], it[1]), it[2]};
  ptr.push_back({0, 0, 0});
  ptr.push_back({inf, inf, 0});
  sort(begin(ptr), end(ptr));
  for (auto& it : ptr) x.push_back(it[0]);
  for (auto& it : ptr) x.push_back(it[1]);
  sort(begin(x), end(x));
  x.resize(unique(begin(x), end(x)) - begin(x));
  stree tr(x);
  map<long long, vector<pair<long long, long long>>> m;
  for (auto& it : ptr) m[it[0]].push_back({it[1], it[2]});
  for (auto& it : m) {
    for (auto& itt : it.second) {
      long long ind = lower_bound(begin(x), end(x), itt.first) - begin(x);
      tr.set(ind, tr.n, itt.second);
    }
  }
  long long res = 0;
  pair<long long, long long> resp;
  for (long long i = 0;; ++i) {
    if (s.count({i, i})) continue;
    resp = {i, i};
    break;
  }
  auto iter = m.begin();
  ++iter;
  for (auto& it : m) {
    if (it.first == inf) break;
    long long ind = lower_bound(begin(x), end(x), it.first) - begin(x) - 1;
    for (; ind >= 0; --ind) {
      long long curres = tr.get(ind, ind + 1).first;
      if (curres < -INF / 2) break;
      tr.set(ind, ind + 1, -INF);
    }
    pair<long long, long long> curres = tr.get(0, tr.n);
    if (curres.first > res) {
      res = curres.first;
      resp.first = it.first;
      resp.second = x[curres.second];
    }
    for (auto& itt : it.second) {
      long long ind = lower_bound(begin(x), end(x), itt.first) - begin(x);
      tr.set(ind, tr.n, -itt.second);
    }
    long long dif = iter->first - it.first;
    tr.set(lower_bound(begin(x), end(x), it.first) - begin(x), tr.n, dif);
    if (iter == m.end()) break;
    ++iter;
  }
  cout << res << endl;
  cout << resp.first << " " << resp.first << " " << resp.second << " "
       << resp.second;
  return 0;
}