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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long MOD = 1000000007;
long double EPS = 1e-9;
long long binpow(long long b, long long p, long long mod) {
  long long ans = 1;
  b %= mod;
  for (; p; p >>= 1) {
    if (p & 1) ans = ans * b % mod;
    b = b * b % mod;
  }
  return ans;
}
void pre() {}
map<long long, long long> compmp;
long long rev[500100];
long long compcnt;
vector<long long> compress(vector<long long> arr) {
  for (auto v : arr) compmp[v];
  for (auto v : compmp) {
    compmp[v.first] = compcnt++;
    rev[compcnt - 1] = v.first;
  }
  for (long long i = 0; i < (arr.size()); ++i) arr[i] = compmp[arr[i]];
  return arr;
}
void compreset() {
  compmp.clear();
  compcnt = 0;
}
vector<long long> ender;
vector<long long> pos;
vector<long long> sortedpos;
pair<long long, long long> t[4000100];
long long lazy[4000100];
void push(long long id, long long l, long long r) {
  if (lazy[id] != 0) {
    t[id].first += lazy[id];
    if (l != r) {
      lazy[id << 1] += lazy[id];
      lazy[id << 1 | 1] += lazy[id];
    }
    lazy[id] = 0;
  }
}
void build(long long id, long long l, long long r) {
  lazy[id] = 0;
  if (l == r) {
    t[id] = make_pair(-sortedpos[l], sortedpos[l]);
    return;
  }
  build(id << 1, l, ((l + r) >> 1));
  build(id << 1 | 1, ((l + r) >> 1) + 1, r);
  t[id] = max(t[id << 1], t[id << 1 | 1]);
}
void update(long long id, long long l, long long r, long long lq, long long rq,
            long long val) {
  push(id, l, r);
  if (l > r || lq > r || l > rq) return;
  if (lq <= l && r <= rq) {
    lazy[id] += val;
    push(id, l, r);
    return;
  }
  update(id << 1, l, ((l + r) >> 1), lq, rq, val);
  update(id << 1 | 1, ((l + r) >> 1) + 1, r, lq, rq, val);
  t[id] = max(t[id << 1], t[id << 1 | 1]);
}
pair<long long, long long> get(long long id, long long l, long long r,
                               long long lq, long long rq) {
  push(id, l, r);
  if (l > r || lq > r || l > rq) return make_pair(-MOD * MOD, lq);
  if (lq <= l && r <= rq) {
    return t[id];
  }
  return max(get(id << 1, l, ((l + r) >> 1), lq, rq),
             get(id << 1 | 1, ((l + r) >> 1) + 1, r, lq, rq));
}
using iii = pair<pair<long long, long long>, long long>;
vector<iii> arr;
void activate(long long i) {
  update(1, 0, compcnt - 1, pos[i], compcnt - 1, arr[i].second);
}
void solve() {
  long long n;
  cin >> n;
  arr.resize(n);
  for (long long i = 0; i < (n); ++i) {
    cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second;
  }
  vector<pair<long long, long long> > activation;
  for (long long i = 0; i < (n); ++i) {
    activation.emplace_back(
        make_pair(min(arr[i].first.first, arr[i].first.second), i));
  }
  sort((activation).begin(), (activation).end());
  for (long long i = 0; i < (n); ++i) {
    ender.emplace_back(max(arr[i].first.first, arr[i].first.second));
  }
  pos = compress(ender);
  {};
  sortedpos.resize(compcnt);
  for (long long i = 0; i < (n); ++i) {
    sortedpos[pos[i]] = ender[i];
  }
  {};
  reverse((activation).begin(), (activation).end());
  build(1, 0, compcnt - 1);
  {};
  pair<long long, pair<long long, long long> > best =
      make_pair(0, make_pair(MOD, MOD));
  for (long long i = 0; i < (activation.size()); ++i) {
    long long j = i;
    while (j < activation.size() &&
           activation[j].first == activation[i].first) {
      activate(activation[j].second);
      j++;
    }
    long long posinsorted = lower_bound((sortedpos).begin(), (sortedpos).end(),
                                        activation[i].first) -
                            sortedpos.begin();
    pair<long long, long long> rangebest =
        get(1, 0, compcnt - 1, posinsorted, compcnt - 1);
    rangebest.first += activation[i].first;
    (best = max((best),
                (make_pair(rangebest.first,
                           make_pair(activation[i].first, rangebest.second)))));
    i = j - 1;
  }
  cout << best.first << '\n';
  cout << best.second.first << " " << best.second.first << " "
       << best.second.second << " " << best.second.second << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pre();
  long long _t = 1;
  for (long long i = 1; i <= _t; i++) {
    solve();
  }
}