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;
struct pt {
  int x, y, c;
};
const int N = 1e6 + 10;
long long tree[4 * N];
long long lz[4 * N];
int idx[4 * N];
void pull(int x) {
  if (tree[2 * x] < tree[2 * x + 1]) {
    tree[x] = tree[2 * x + 1];
    idx[x] = idx[2 * x + 1];
  } else {
    tree[x] = tree[2 * x];
    idx[x] = idx[2 * x];
  }
}
void build(int x, int l, int r) {
  if (l == r) {
    idx[x] = l;
    tree[x] = 0;
    return;
  }
  int m = (l + r) / 2;
  build(2 * x, l, m);
  build(2 * x + 1, m + 1, r);
  pull(x);
}
void upd(int x, int l, int r, int ll, int rr, long long val) {
  if (ll <= l and r <= rr) {
    tree[x] += val;
    lz[x] += val;
    return;
  }
  if (lz[x]) {
    tree[2 * x] += lz[x];
    tree[2 * x + 1] += lz[x];
    lz[2 * x] += lz[x];
    lz[2 * x + 1] += lz[x];
    lz[x] = 0;
  }
  int m = (l + r) / 2;
  if (m >= ll) upd(2 * x, l, m, ll, rr, val);
  if (m < rr) upd(2 * x + 1, m + 1, r, ll, rr, val);
  pull(x);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pt> v(n);
  vector<int> s(2 * n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].x >> v[i].y >> v[i].c;
    s[2 * i] = v[i].x, s[2 * i + 1] = v[i].y;
  }
  sort(s.begin(), s.end());
  map<int, int> m;
  m[0] = 0;
  vector<int> rev = {0};
  for (auto x : s) {
    if (m.find(x) == m.end()) {
      m[x] = m.size();
      rev.push_back(x);
    }
  }
  sort(v.begin(), v.end(),
       [&](pt a, pt b) { return max(a.x, a.y) < max(b.x, b.y); });
  build(1, 0, N - 1);
  long long ans = 0;
  int r1 = 2e9, r2 = 2e9;
  int cnt = 0;
  for (int i = 0; i < n;) {
    int tmp = max(v[i].x, v[i].y);
    int prm = 0;
    while (cnt < rev.size() and rev[cnt] < tmp) {
      upd(1, 0, N - 1, prm, cnt, rev[cnt] - tmp);
      prm = ++cnt;
    };
    do {
      upd(1, 0, N - 1, 0, m[min(v[i].x, v[i].y)], v[i].c);
    } while (++i < n and tmp == max(v[i].x, v[i].y));
    if (ans < tree[1]) {
      ans = tree[1];
      r1 = rev[idx[1]];
      r2 = tmp;
    }
  }
  cout << ans << '\n';
  cout << r1 << ' ' << r1 << ' ' << r2 << ' ' << r2 << '\n';
}