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;
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
const int N = 1e6 + 5, MOD = 1e9 + 7;
long long seg[4 * N], lazy[4 * N];
int ans[4 * N];
void build(int id, int s, int e) {
  lazy[id] = 0;
  if (s == e) {
    seg[id] = 0;
    ans[id] = s;
    return;
  }
  int mid = s + (e - s) / 2;
  int ch1 = 2 * id, ch2 = ch1 + 1;
  build(ch1, s, mid);
  build(ch2, mid + 1, e);
  if (seg[ch1] >= seg[ch2]) {
    seg[id] = seg[ch1];
    ans[id] = ans[ch1];
  } else {
    seg[id] = seg[ch2];
    ans[id] = ans[ch2];
  }
}
void push_down(int id, int s, int e) {
  if (lazy[id]) {
    seg[id] += lazy[id];
    if (s != e) {
      int ch1 = 2 * id, ch2 = ch1 + 1;
      lazy[ch1] += lazy[id];
      lazy[ch2] += lazy[id];
    }
  }
  lazy[id] = 0;
}
void update(int id, int s, int e, int l, int r, int val) {
  push_down(id, s, e);
  if (s > r || e < l) return;
  if (s >= l && e <= r) {
    lazy[id] += val;
    push_down(id, s, e);
    return;
  }
  int mid = s + (e - s) / 2;
  int ch1 = 2 * id, ch2 = ch1 + 1;
  update(ch1, s, mid, l, r, val);
  update(ch2, mid + 1, e, l, r, val);
  if (seg[ch1] >= seg[ch2]) {
    seg[id] = seg[ch1];
    ans[id] = ans[ch1];
  } else {
    seg[id] = seg[ch2];
    ans[id] = ans[ch2];
  }
}
pair<long long, int> query(int id, int s, int e, int l, int r) {
  push_down(id, s, e);
  if (s > r || e < l) return {-1e18, -1};
  if (s >= l && e <= r) return {seg[id], ans[id]};
  int mid = s + (e - s) / 2;
  int ch1 = 2 * id, ch2 = ch1 + 1;
  return max(query(ch1, s, mid, l, r), query(ch2, mid + 1, e, l, r));
}
int main() {
  file();
  fast();
  int n;
  cin >> n;
  set<int> st;
  vector<vector<int>> a(n, vector<int>(3));
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
    st.insert(a[i][0]);
    st.insert(a[i][1]);
  }
  vector<int> actual(st.size() + 1);
  map<int, int> mp;
  int idx = 1;
  for (int i : st) {
    actual[idx] = i;
    mp[i] = idx++;
  }
  n = idx - 1;
  build(1, 1, n);
  for (int i = 1; i <= n; i++) update(1, 1, n, i, i, -(actual[i] - actual[1]));
  vector<vector<pair<int, int>>> v(idx);
  for (auto &i : a) {
    i[0] = mp[i[0]];
    i[1] = mp[i[1]];
    int l = min(i[0], i[1]);
    int r = max(i[0], i[1]);
    v[l].emplace_back(r, i[2]);
    update(1, 1, n, r, n, i[2]);
  }
  long long mx = 0;
  int xy1 = 2e9, xy2 = 2e9;
  for (int i = 1; i <= n; i++) {
    if (i > 1) update(1, 1, n, i, n, (actual[i] - actual[i - 1]));
    auto p = query(1, 1, n, i, n);
    if (p.first > mx) {
      mx = p.first;
      xy1 = i;
      xy2 = p.second;
    }
    while (v[i].size()) {
      update(1, 1, n, v[i].back().first, n, -v[i].back().second);
      v[i].pop_back();
    }
  }
  cout << mx << "\n";
  if (xy1 != 2e9) {
    xy1 = actual[xy1];
    xy2 = actual[xy2];
  }
  cout << xy1 << " " << xy1 << " " << xy2 << " " << xy2 << "\n";
}