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;
using LL = long long;
template <class T>
inline bool asMn(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool asMx(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
const LL infLL = 1e18;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
vector<int> com;
struct It {
  int n;
  vector<pair<LL, int> > mx;
  vector<LL> lz;
  It(int _n) : n(_n) {
    mx.assign(n << 2, {});
    lz.assign(n << 2, 0);
    build(1, 0, n - 1);
  }
  void build(int i, int Left, int Right) {
    if (Left == Right) {
      mx[i] = {-com[Left], Left};
      return;
    }
    build((i << 1), Left, ((Left + Right) >> 1));
    build((i << 1 | 1), ((Left + Right) >> 1) + 1, Right);
    mx[i] = max(mx[(i << 1)], mx[(i << 1 | 1)]);
  }
  void trueVal(int i, int Left, int Right) {
    if (!lz[i]) return;
    mx[i].first += lz[i];
    if (Left ^ Right) lz[(i << 1)] += lz[i], lz[(i << 1 | 1)] += lz[i];
    lz[i] = 0;
  }
  void add(int l, int r, int val, int i, int Left, int Right) {
    trueVal(i, Left, Right);
    if (r < Left || Right < l) return;
    if (l <= Left && Right <= r) {
      lz[i] = val;
      trueVal(i, Left, Right);
      return;
    }
    add(l, r, val, (i << 1), Left, ((Left + Right) >> 1));
    add(l, r, val, (i << 1 | 1), ((Left + Right) >> 1) + 1, Right);
    mx[i] = max(mx[(i << 1)], mx[(i << 1 | 1)]);
  }
  void add(int l, int r, int val) { add(l, r, val, 1, 0, n - 1); }
  pair<LL, int> get(int l, int r, int i, int Left, int Right) {
    trueVal(i, Left, Right);
    if (l <= Left && Right <= r) return mx[i];
    if (((Left + Right) >> 1) < l)
      return get(l, r, (i << 1 | 1), ((Left + Right) >> 1) + 1, Right);
    else if (r <= ((Left + Right) >> 1))
      return get(l, r, (i << 1), Left, ((Left + Right) >> 1));
    else
      return max(get(l, r, (i << 1), Left, ((Left + Right) >> 1)),
                 get(l, r, (i << 1 | 1), ((Left + Right) >> 1) + 1, Right));
  }
  pair<LL, int> get(int l, int r) { return get(l, r, 1, 0, n - 1); }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<tuple<int, int, int> > p(n);
  for (auto &i : p) {
    cin >> get<0>(i) >> get<1>(i) >> get<2>(i);
    com.emplace_back(get<0>(i));
    com.emplace_back(get<1>(i));
  }
  com.emplace_back(0);
  sort((com).begin(), (com).end());
  com.erase(unique((com).begin(), (com).end()), com.end());
  It it(((int)(com).size()));
  vector<vector<pair<int, int> > > change(((int)(com).size()));
  for (auto &i : p) {
    get<0>(i) =
        (int)(lower_bound((com).begin(), (com).end(), get<0>(i)) - com.begin());
    get<1>(i) =
        (int)(lower_bound((com).begin(), (com).end(), get<1>(i)) - com.begin());
    change[min(get<0>(i), get<1>(i))].emplace_back(max(get<0>(i), get<1>(i)),
                                                   get<2>(i));
    it.add(max(get<0>(i), get<1>(i)), it.n - 1, get<2>(i));
  }
  tuple<LL, int, int> ans(0, com.back() + 1, com.back() + 1);
  for (int i = 0; i < ((int)(com).size()); ++i) {
    auto tmp = it.get(i, it.n - 1);
    asMx(ans, {com[i] + tmp.first, com[i], com[tmp.second]});
    for (const auto &j : change[i]) it.add(j.first, it.n - 1, -j.second);
  }
  cout << get<0>(ans) << '\n'
       << get<1>(ans) << ' ' << get<1>(ans) << ' ' << get<2>(ans) << ' '
       << get<2>(ans) << '\n';
  return 0;
}