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 piii {
  long long first;
  int second, th;
  bool operator<(const piii &b) {
    if (first != b.first) return first < b.first;
    if (second != b.second) return second < b.second;
    return th < b.th;
  }
};
const int maxn = 5e5 + 5;
const long long oo = 1e18;
int n;
long long res, xres, yres;
piii a[maxn];
pair<long long, long long> st[maxn * 16];
long long lz[maxn * 16];
vector<long long> b;
vector<piii> c[maxn * 4];
void input() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].th >> a[i].first;
    a[i].second++;
    a[i].th++;
  }
}
void init() {
  for (int i = 0; i < n; i++) {
    b.push_back(a[i].second);
    b.push_back(a[i].th);
    b.push_back(a[i].second - 1);
    b.push_back(a[i].th - 1);
  }
  b.push_back(-1);
  sort(b.begin(), b.end());
  b.resize(unique(b.begin(), b.end()) - b.begin());
  for (int i = 0; i < n; i++) {
    int tmp =
        lower_bound(b.begin(), b.end(), max(a[i].second, a[i].th)) - b.begin();
    c[tmp].push_back(a[i]);
  }
  res = 0, xres = yres = 2e9;
}
void initst(int id, int l, int r) {
  st[id] = pair<long long, long long>({-b[r], b[r]});
  if (l == r) return;
  int mid = (l + r) >> 1;
  initst(id * 2, l, mid);
  initst(id * 2 + 1, mid + 1, r);
}
void down(int id, long long val) {
  st[id].first += val;
  lz[id] += val;
}
pair<long long, long long> join(pair<long long, long long> x,
                                pair<long long, long long> y) {
  return (x.first < y.first ? x : y);
}
void up(int id, int l, int r, int u, int v, long long val) {
  if (v < l || u > r) return;
  if (u <= l && v >= r) {
    down(id, val);
    return;
  }
  down(id * 2, lz[id]);
  down(id * 2 + 1, lz[id]);
  lz[id] = 0;
  int mid = (l + r) >> 1;
  up(id * 2, l, mid, u, v, val);
  up(id * 2 + 1, mid + 1, r, u, v, val);
  st[id] = join(st[id * 2], st[id * 2 + 1]);
}
pair<long long, long long> get(int id, int l, int r, int u, int v) {
  if (v < l || u > r) return pair<long long, long long>({oo, 0});
  if (u <= l && v >= r) return st[id];
  down(id * 2, lz[id]);
  down(id * 2 + 1, lz[id]);
  lz[id] = 0;
  int mid = (l + r) >> 1;
  return join(get(id * 2, l, mid, u, v), get(id * 2 + 1, mid + 1, r, u, v));
}
void pp() {
  long long sum = 0;
  for (int i = 1; i < b.size(); i++) {
    for (piii j : c[i]) sum += j.first;
    for (piii j : c[i]) {
      int tmp = min(j.second, j.th);
      tmp = lower_bound(b.begin(), b.end(), tmp) - b.begin();
      up(1, 1, b.size() - 1, tmp, b.size() - 1, j.first);
    }
    pair<long long, long long> tmp = get(1, 1, b.size() - 1, 1, i);
    if (sum - b[i] - tmp.first > res) {
      res = sum - b[i] - tmp.first;
      xres = tmp.second + 1;
      yres = b[i];
    }
    up(1, 1, b.size() - 1, i, i, -1);
  }
}
int main() {
  cout << setprecision(2) << fixed;
  ios::sync_with_stdio(false), cin.tie(0);
  input();
  init();
  initst(1, 1, b.size() - 1);
  pp();
  xres--;
  yres--;
  cout << res << endl;
  cout << xres << ' ' << xres << ' ' << yres << ' ' << yres;
  return 0;
}