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;
const int NAX = 2e5 + 5, MOD = 1000000007;
const ll INF = 1e18;
struct Node {
  long long val;
  int idx;
  Node(long long one = 0, int id = -1) : val(one), idx(id) {}
  Node lazylazyMerge(const Node &rhs) {
    Node a = *this;
    a.val = (a.val + rhs.val);
    return a;
  }
  Node seglazyMerge(const Node &rhs, const int &l, const int &r) {
    Node a = *this;
    a.val += (rhs.val);
    return a;
  }
  Node segSegMerge(const Node &rhs) {
    if (idx == -1) return rhs;
    if (rhs.idx == -1) return *this;
    if (val > rhs.val) return *this;
    if (val < rhs.val) return rhs;
    if (idx < rhs.idx) return *this;
    if (idx > rhs.idx) return rhs;
    return *this;
  }
};
template <typename segNode>
struct Segtree {
  vector<segNode> Seg, Lazy;
  vector<segNode> Base;
  vector<bool> isLazy;
  int n;
  Segtree(int _n = 2e5) {
    this->n = _n;
    Seg.resize(4 * _n + 10);
    Lazy.resize(4 * _n + 10);
    isLazy.resize(4 * _n + 10);
  }
  void propagate(int node, int L, int R) {
    if (isLazy[node]) {
      isLazy[node] = false;
      Seg[node] = Seg[node].seglazyMerge(Lazy[node], L, R);
      if (L != R) {
        Lazy[2 * node] = Lazy[2 * node].lazylazyMerge(Lazy[node]);
        Lazy[2 * node + 1] = Lazy[2 * node + 1].lazylazyMerge(Lazy[node]);
        isLazy[2 * node] = true;
        isLazy[2 * node + 1] = true;
      }
      Lazy[node] = segNode();
    }
  }
  void build(int node, int start, int end) {
    if (start == end) {
      Seg[node] = Base[start];
      return;
    }
    int mid = (start + end) / 2;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
    Seg[node] = Seg[2 * node].segSegMerge(Seg[2 * node + 1]);
  }
  void build(vector<segNode> &Arr) {
    Base = Arr;
    n = Arr.size();
    Seg.resize(4 * n + 10);
    Lazy.resize(4 * n + 10);
    isLazy.resize(4 * n + 10);
    build(1, 0, n - 1);
  }
  segNode Query(int node, int start, int end, int qstart, int qend) {
    propagate(node, start, end);
    if (qend < start || qstart > end || start > end) return segNode(-INF, -1);
    if (qstart <= start && end <= qend) return Seg[node];
    int mid = (start + end) / 2;
    segNode l = Query(2 * node, start, mid, qstart, qend);
    segNode r = Query(2 * node + 1, mid + 1, end, qstart, qend);
    return l.segSegMerge(r);
  }
  segNode qQuery(int node, int start, int end, int pos) {
    propagate(node, start, end);
    if (start == end) return Seg[node];
    int mid = (start + end) / 2;
    if (pos <= mid) return qQuery(2 * node, start, mid, pos);
    return qQuery(2 * node + 1, mid + 1, end, pos);
  }
  void Update(int node, int start, int end, int qstart, int qend, segNode val) {
    propagate(node, start, end);
    if (qend < start || qstart > end || start > end) return;
    if (qstart <= start && end <= qend) {
      isLazy[node] = true;
      Lazy[node] = val;
      propagate(node, start, end);
      return;
    }
    int mid = (start + end) / 2;
    Update(2 * node, start, mid, qstart, qend, val);
    Update(2 * node + 1, mid + 1, end, qstart, qend, val);
    Seg[node] = Seg[2 * node].segSegMerge(Seg[2 * node + 1]);
  }
  void pUpdate(int node, int start, int end, int pos, segNode val) {
    propagate(node, start, end);
    if (start == end) {
      Seg[node] = val;
      return;
    }
    int mid = (start + end) / 2;
    if (pos <= mid)
      pUpdate(2 * node, start, mid, pos, val);
    else
      pUpdate(2 * node + 1, mid + 1, end, pos, val);
    Seg[node] = Seg[2 * node].segSegMerge(Seg[2 * node + 1]);
  }
  segNode query(int pos) { return qQuery(1, 0, n - 1, pos); }
  segNode query(int left, int right) { return Query(1, 0, n - 1, left, right); }
  void update(int pos, segNode val) { pUpdate(1, 0, n - 1, pos, val); }
  void update(int start, int end, segNode val) {
    Update(1, 0, n - 1, start, end, val);
  }
};
void solveCase() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(3));
  vector<int> vals;
  for (auto &x : a) {
    for (auto &y : x) cin >> y;
    vals.push_back(x[0]);
    vals.push_back(x[1]);
  }
  vals.push_back(0);
  sort(vals.begin(), vals.end());
  vals.resize(unique(vals.begin(), vals.end()) - vals.begin());
  vals.push_back(vals.back() + 1);
  vector<pair<int, int>> ev[vals.size()];
  for (auto &x : a) {
    int one = lower_bound(vals.begin(), vals.end(), x[0]) - vals.begin();
    int two = lower_bound(vals.begin(), vals.end(), x[1]) - vals.begin();
    ev[min(one, two)].emplace_back(max(one, two), x[2]);
  }
  Segtree<Node> stree(vals.size());
  ;
  for (size_t i = 0; i < vals.size(); i++) {
    stree.update(i, Node(-vals[i], i));
    auto q = stree.query(i);
    ;
  }
  ll ans = -INF;
  int l, r;
  l = r = -1;
  for (int i = vals.size() - 1; i >= 0; i--) {
    for (auto &it : ev[i]) stree.update(it.first, vals.size() - 1, it.second);
    auto cur = stree.query(i, vals.size() - 1);
    ;
    if (cur.val + vals[i] > ans) {
      ans = cur.val + vals[i];
      l = vals[i];
      r = vals[cur.idx];
    }
  }
  cout << ans << '\n';
  cout << l << ' ';
  cout << l << ' ';
  cout << r << ' ';
  cout << r << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; ++i) {
    solveCase();
  }
  return 0;
}