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;
template <typename T>
vector<T> compress(vector<T> v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  return v;
}
template <typename T>
map<T, long long> dict(const vector<T> &v) {
  map<T, long long> res;
  for (long long i = 0; i < (long long)v.size(); i++) res[v[i]] = i;
  return res;
}
template <typename T, typename E>
struct SegmentTree {
  using F = function<T(T, T)>;
  using G = function<T(T, E, long long)>;
  using H = function<E(E, E)>;
  long long n;
  F f;
  G g;
  H h;
  T ti;
  E ei;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(F f, G g, H h, T ti, E ei) : f(f), g(g), h(h), ti(ti), ei(ei) {}
  void init(long long n_) {
    n = 1;
    while (n < n_) n <<= 1;
    dat.assign((n << 1) - 1, ti);
    laz.assign((n << 1) - 1, ei);
  }
  void build(const vector<T> &v) {
    long long n_ = v.size();
    init(n_);
    for (long long i = 0; i < n_; i++) dat[n + i - 1] = v[i];
    for (long long i = n - 2; i >= 0; i--)
      dat[i] = f(dat[(i << 1) + 2], dat[(i << 1) | 1]);
  }
  void eval(long long k, long long l, long long r) {
    if (laz[k] == ei) return;
    dat[k] = g(dat[k], laz[k], r - l);
    if (r - l > 1) {
      laz[(k << 1) | 1] = h(laz[(k << 1) | 1], laz[k]);
      laz[(k << 1) + 2] = h(laz[(k << 1) + 2], laz[k]);
    }
    laz[k] = ei;
  }
  void update(long long a, long long b, E x, long long k = 0, long long l = 0,
              long long r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      laz[k] = h(laz[k], x);
      eval(k, l, r);
    } else {
      update(a, b, x, (k << 1) | 1, l, (l + r) / 2);
      update(a, b, x, (k << 1) + 2, (l + r) / 2, r);
      dat[k] = f(dat[(k << 1) | 1], dat[(k << 1) + 2]);
    }
  }
  T query(long long a, long long b, long long k = 0, long long l = 0,
          long long r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return ti;
    if (a <= l && r <= b) return dat[k];
    T xl = query(a, b, (k << 1) | 1, l, (l + r) / 2);
    T xr = query(a, b, (k << 1) + 2, (l + r) / 2, r);
    return f(xl, xr);
  }
  template <typename C>
  long long find(long long a, long long b, C &check, T x, long long k = 0,
                 long long l = 0, long long r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (!check(f(x, dat[k])) || r <= a || b <= l) return -1;
    if (r - l == 1) return l;
    long long xl = find(a, b, check, x, (k << 1) | 1, l, (l + r) / 2);
    if (xl >= 0) return xl;
    x = f(x, dat[(k << 1) | 1]);
    return find(a, b, check, x, (k << 1) + 2, (l + r) / 2, r);
  }
  template <typename C>
  long long find(long long a, long long b, C &check) {
    T x = ti;
    return find(a, b, check, x);
  }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  using T = tuple<long long, long long, long long>;
  vector<T> t(n);
  vector<long long> x;
  for (long long i = (0); i < ((n)); ++i) {
    long long a, b, c;
    cin >> a >> b >> c;
    if (a > b) swap(a, b);
    t[i] = T(a, b, c);
    x.push_back(b);
  }
  sort(t.begin(), t.end());
  auto r = compress(x);
  auto v = dict(r);
  long long N = v.size();
  vector<pair<long long, long long> > sum(N + 1,
                                          pair<long long, long long>(0, 0));
  for (long long i = (0); i < ((n)); ++i) {
    long long a, b, c;
    tie(a, b, c) = t[i];
    sum[v[b]].first += c;
  }
  for (long long i = (0); i < ((N)); ++i) sum[i + 1].first += sum[i].first;
  for (long long i = (0); i < ((N)); ++i)
    sum[i].first -= r[i], sum[i].second = i;
  auto f = [](pair<long long, long long> a, pair<long long, long long> b) {
    return max(a, b);
  };
  auto g = [](pair<long long, long long> a, long long b, long long len) {
    return pair<long long, long long>(a.first + b, a.second);
  };
  auto h = [](long long a, long long b) { return a + b; };
  SegmentTree<pair<long long, long long>, long long> seg(
      f, g, h, pair<long long, long long>(-(1LL << 60), -(1LL << 60)), 0);
  seg.build(sum);
  long long ans = 0, id = 0, id2 = 0, L = 0, R = 0;
  for (long long i = (0); i < ((n)); ++i) {
    long long a, b, c;
    tie(a, b, c) = t[i];
    while (id < n) {
      long long u, o, w;
      tie(u, o, w) = t[id];
      if (u >= a) break;
      seg.update(v[o], N, -w);
      id++;
    }
    while (id2 < N && r[id2] < a) id2++;
    pair<long long, long long> p = seg.query(id2, N);
    long long now = p.first + a;
    if (ans < now) {
      ans = now;
      L = a;
      R = r[p.second];
    }
  }
  if (ans == 0) {
    cout << ans << endl;
    cout << (long long)2e9 << " " << (long long)2e9 << " " << (long long)2e9
         << " " << (long long)2e9 << endl;
  } else {
    cout << ans << endl;
    cout << L << " " << L << " " << R << " " << R << endl;
  }
  return 0;
}