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 int64_t INF = 1e18;
const pair<int64_t, int> MINFP = {-INF, 0};
template <typename T>
struct SetF {
  typedef function<void(T& a, T b)> func2;
  func2 f;
  T e;
  SetF() {}
  SetF(func2 f, T e) : f(f), e(e) {}
};
SetF<pair<int64_t, int> > setf_add(
    [](pair<int64_t, int>& a, pair<int64_t, int> b) { a.first += b.first; },
    {0, 0});
template <typename T>
struct GetF {
  typedef function<T(T a)> func1;
  typedef function<T(T a, int width)> func_int;
  typedef function<T(T a, T b)> func2;
  func2 f;
  func_int expand;
  T e;
  GetF() {}
  GetF(func2 f, func_int expand, T e) : f(f), expand(expand), e(e) {}
};
GetF<pair<int64_t, int> > getf_max(
    [](pair<int64_t, int> a, pair<int64_t, int> b) { return max(a, b); },
    [](pair<int64_t, int> a, int w) { return a; }, MINFP);
template <typename T>
struct LazySegtree {
  int n;
  vector<T> dat, laz;
  vector<bool> lazflag;
  SetF<T> setf;
  GetF<T> getf;
  LazySegtree() {}
  LazySegtree(int n_input, SetF<T> setf_input, GetF<T> getf_input) {
    initialize(n_input, setf_input, getf_input);
  }
  void initialize(int n_input, SetF<T> setf_input, GetF<T> getf_input) {
    n = 1;
    while (n < n_input) n <<= 1;
    setf = setf_input;
    getf = getf_input;
    dat.resize(2 * n - 1, getf.e);
    laz.resize(2 * n - 1, setf.e);
    lazflag.resize(2 * n - 1, false);
  }
  void build(vector<T>& A) {
    for (int k = 0; k < A.size(); k++) dat[k + n - 1] = A[k];
    for (int k = n - 2; k >= 0; k--)
      dat[k] = getf.f(dat[2 * k + 1], dat[2 * k + 2]);
  }
  void eval(int k, int l, int r) {
    if (!lazflag[k]) return;
    setf.f(dat[k], getf.expand(laz[k], r - l));
    if (r - l > 1) {
      setf.f(laz[2 * k + 1], laz[k]);
      setf.f(laz[2 * k + 2], laz[k]);
      lazflag[2 * k + 1] = lazflag[2 * k + 2] = true;
    }
    laz[k] = setf.e;
    lazflag[k] = false;
  }
  void update_between(int a, int b, T x) { update(a, b + 1, x, 0, 0, n); }
  void update(int a, int b, T x, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      setf.f(laz[k], x);
      lazflag[k] = true;
      eval(k, l, r);
    } else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = getf.f(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  void force_set(int a, T x) {
    get_between(a, a);
    int k = a + n - 1;
    dat[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = getf.f(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  T get_between(int a, int b) { return query(a, b + 1, 0, 0, n); }
  T query(int a, int b, int k, int l, int r) {
    eval(k, l, r);
    if (r <= a || b <= l) return getf.e;
    if (a <= l && r <= b) return dat[k];
    T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return getf.f(vl, vr);
  }
};
int main() {
  int N;
  static int X[500000], Y[500000], C[500000];
  cin >> N;
  vector<int> cmp;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d", &X[i], &Y[i], &C[i]);
    cmp.push_back(X[i]);
    cmp.push_back(Y[i]);
  }
  sort(cmp.begin(), cmp.end());
  cmp.erase(unique(cmp.begin(), cmp.end()), cmp.end());
  int sz = cmp.size();
  static vector<int> L2i[1000000];
  for (int i = 0; i < N; i++) {
    X[i] = lower_bound(cmp.begin(), cmp.end(), X[i]) - cmp.begin();
    Y[i] = lower_bound(cmp.begin(), cmp.end(), Y[i]) - cmp.begin();
    L2i[min(X[i], Y[i])].push_back(i);
  }
  const int OUT = 1e9 + 1;
  vector<int64_t> ans = {0, OUT, OUT};
  LazySegtree<pair<int64_t, int> > st(sz, setf_add, getf_max);
  vector<pair<int64_t, int> > ini(sz);
  for (int i = 0; i < sz; i++) ini[i] = {-cmp[i], i};
  st.build(ini);
  for (int l = sz - 1; l >= 0; l--) {
    for (int i : L2i[l]) {
      int r = max(X[i], Y[i]);
      st.update_between(r, sz - 1, {C[i], 0});
    }
    auto Res = st.get_between(l, sz - 1);
    int64_t val = Res.first + cmp[l];
    vector<int64_t> res = {val, cmp[l], cmp[Res.second]};
    ans = max(ans, res);
  }
  cout << ans[0] << endl;
  cout << ans[1] << " " << ans[1] << " " << ans[2] << " " << ans[2] << endl;
  return 0;
}