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 = 1000010;
int n, m;
int gi() {
  char a = getchar();
  int b = 0;
  while (a < '0' || a > '9') a = getchar();
  while (a >= '0' && a <= '9') b = b * 10 + a - '0', a = getchar();
  return b;
}
struct {
  int l, r, id;
  long long mx, lazy;
} t[maxn * 4];
void tpush(int k) {
  t[k * 2].mx += t[k].lazy;
  t[k * 2 + 1].mx += t[k].lazy;
  t[k * 2].lazy += t[k].lazy;
  t[k * 2 + 1].lazy += t[k].lazy;
  t[k].lazy = 0;
}
void tup(int k) {
  if (t[k * 2].lazy) tpush(k * 2);
  if (t[k * 2 + 1].lazy) tpush(k * 2 + 1);
  if (t[k * 2].mx > t[k * 2 + 1].mx)
    t[k].mx = t[k * 2].mx, t[k].id = t[k * 2].id;
  else
    t[k].mx = t[k * 2 + 1].mx, t[k].id = t[k * 2 + 1].id;
}
void tbu(int k, int l, int r) {
  t[k].l = l;
  t[k].r = r;
  t[k].lazy = 0;
  t[k].mx = 0;
  if (l == r) {
    t[k].id = l;
    return;
  }
  int mid = (l + r) / 2;
  tbu(k * 2, l, mid);
  tbu(k * 2 + 1, mid + 1, r);
  tup(k);
}
void tupdate(int k, int l, int r, int x, int y, long long c) {
  tpush(k);
  if (t[k].l == x && t[k].r == y) {
    t[k].mx += c;
    t[k].lazy = c;
    return;
  }
  int mid = (t[k].l + t[k].r) / 2;
  if (y <= mid)
    tupdate(k * 2, l, mid, x, y, c);
  else if (x > mid)
    tupdate(k * 2 + 1, mid + 1, r, x, y, c);
  else {
    tupdate(k * 2, l, mid, x, mid, c);
    tupdate(k * 2 + 1, mid + 1, r, mid + 1, y, c);
  }
  tup(k);
}
pair<long long, long long> tqu(int k, int l, int r) {
  tpush(k);
  if (t[k].l == l && t[k].r == r) return make_pair(t[k].mx, t[k].id);
  int mid = (t[k].l + t[k].r) / 2;
  if (r <= mid)
    return tqu(k * 2, l, r);
  else if (l > mid)
    return tqu(k * 2 + 1, l, r);
  else
    return max(tqu(k * 2, l, mid), tqu(k * 2 + 1, mid + 1, r));
}
long long x[maxn], y[maxn], c[maxn], xid[maxn], yid[maxn];
vector<long long> vx, vy;
vector<int> R[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> c[i];
    if (x[i] > y[i]) swap(x[i], y[i]);
    vx.push_back(x[i]);
    vy.push_back(y[i]);
  }
  sort(vx.begin(), vx.end());
  vx.resize(unique(vx.begin(), vx.end()) - vx.begin());
  for (int i = 0; i < n; ++i)
    xid[i] = lower_bound(vx.begin(), vx.end(), x[i]) - vx.begin();
  sort(vy.begin(), vy.end());
  vy.resize(unique(vy.begin(), vy.end()) - vy.begin());
  for (int i = 0; i < n; i++)
    yid[i] = lower_bound(vy.begin(), vy.end(), y[i]) - vy.begin(),
    R[yid[i]].push_back(i);
  tbu(1, 0, vx.size());
  for (int i = 0; i < vx.size(); i++) {
    tupdate(1, 0, vx.size(), i, i, vx[i]);
  }
  long long ans = 0, ansl = 2e9, ansr = 2e9;
  for (int i = 0; i < vy.size(); i++) {
    for (int j = 0; j < R[i].size(); j++)
      tupdate(1, 0, vx.size(), 0, xid[R[i][j]], c[R[i][j]]);
    pair<long long, long long> tans =
        tqu(1, 0, upper_bound(vx.begin(), vx.end(), vy[i]) - vx.begin() - 1);
    if (tans.first - vy[i] > ans) {
      ans = tans.first - vy[i];
      ansl = vx[tans.second];
      ansr = vy[i];
    }
  }
  cout << ans << endl;
  cout << ansl << " " << ansl << " " << ansr << " " << ansr << endl;
  return 0;
}