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 int maxn = 1e6 + 17;
int n, m, x[maxn], y[maxn], c[maxn];
long long sina[maxn << 2];
pair<long long, int> iman[maxn << 2];
vector<int> mp;
pair<long long, int> val(int id) {
  return {iman[id].first + sina[id], iman[id].second};
}
void majid(int st, int en, int v, int l = 0, int r = mp.size() + 1,
           int id = 1) {
  if (st <= l && r <= en) {
    sina[id] += v;
    return;
  }
  if (en <= l || r <= st) return;
  int mid = l + r >> 1;
  majid(st, en, v, l, mid, id << 1), majid(st, en, v, mid, r, id << 1 | 1);
  iman[id] = max(val(id << 1), val(id << 1 | 1));
}
void build(int l = 0, int r = mp.size() + 1, int id = 1) {
  iman[id].second = l;
  if (r - l == 1) return;
  int mid = (l + r) / 2;
  build(l, mid, id << 1);
  build(mid, r, id << 1 | 1);
}
vector<int> assign[maxn];
int mpp(int x) { return lower_bound(mp.begin(), mp.end(), x) - mp.begin(); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> c[i];
    mp.push_back(x[i]);
    mp.push_back(y[i]);
  }
  sort(mp.begin(), mp.end());
  mp.erase(unique(mp.begin(), mp.end()), mp.end());
  for (int i = 0; i < n; i++) {
    if (x[i] < y[i]) swap(x[i], y[i]);
    assign[mpp(x[i])].push_back(i);
  }
  build();
  long long ans = 0;
  int sx = 2e9, ex = 2e9;
  for (int i = 0; i < mp.size(); i++) {
    majid(0, i, mp[i - 1] - mp[i]);
    for (auto j : assign[i]) majid(0, mpp(y[j]) + 1, c[j]);
    if (iman[1].first > ans) {
      ans = iman[1].first;
      ex = mp[i];
      sx = mp[iman[1].second];
    }
  }
  cout << ans << '\n' << sx << ' ' << sx << ' ' << ex << ' ' << ex << '\n';
}