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 N = 1000000 + 10;
int n;
long long x[N], y[N], c[N];
vector<int> vx[N], vy[N], v;
int tx[N], ty[N];
bool cmpx(int i, int j) { return x[i] < x[j]; }
bool cmpy(int i, int j) { return y[i] < y[j]; }
int id(long long x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin() + 1;
}
struct Nod {
  long long mx, lz, pos;
  Nod operator+(const Nod& o) const {
    Nod ans;
    ans.lz = 0;
    ans.mx = max(mx, o.mx);
    if (ans.mx == mx) ans.pos = pos;
    if (ans.mx == o.mx) ans.pos = o.pos;
    return ans;
  }
} nod[N << 2];
void upd(Nod& tmp, long long x) {
  tmp.lz += x;
  tmp.mx += x;
}
void build(int l, int r, int rt) {
  nod[rt].mx = 0, nod[rt].lz = 0;
  nod[rt].pos = l;
  if (l == r) {
    nod[rt].pos = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
}
void pushdown(int rt) {
  if (nod[rt].lz) {
    upd(nod[rt << 1], nod[rt].lz);
    upd(nod[rt << 1 | 1], nod[rt].lz);
    nod[rt].lz = 0;
  }
}
void update(int l, int r, int rt, int L, int R, long long x) {
  if (L <= l && r <= R) {
    upd(nod[rt], x);
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(rt);
  if (L <= mid) update(l, mid, rt << 1, L, R, x);
  if (R > mid) update(mid + 1, r, rt << 1 | 1, L, R, x);
  nod[rt] = nod[rt << 1] + nod[rt << 1 | 1];
}
Nod query(int l, int r, int rt, int L, int R) {
  if (L <= l && r <= R) return nod[rt];
  int mid = (l + r) >> 1;
  pushdown(rt);
  if (R <= mid) return query(l, mid, rt << 1, L, R);
  if (L > mid) return query(mid + 1, r, rt << 1 | 1, L, R);
  return query(l, mid, rt << 1, L, R) + query(mid + 1, r, rt << 1 | 1, L, R);
}
int main() {
  scanf("%d", &n);
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &x[i], &y[i], &c[i]);
    v.push_back(x[i]);
    v.push_back(y[i]);
    mp[x[i]] = mp[y[i]] = 1;
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 1; i <= n; i++) {
    vx[id(x[i])].push_back(i);
    vy[id(y[i])].push_back(i);
  }
  int tot = v.size();
  for (int i = 1; i <= tot; i++) {
    sort(vx[i].begin(), vx[i].end(), cmpy);
    sort(vy[i].begin(), vy[i].end(), cmpx);
  }
  build(1, tot, 1);
  long long ans = -1, ax, ay;
  for (int i = 1; i <= tot; i++) {
    if (i >= 2) {
      assert(v[i - 2] - v[i - 1] >= -1e9);
      update(1, tot, 1, 1, i - 1, v[i - 2] - v[i - 1]);
    }
    while (tx[i] < vx[i].size()) {
      int id_ = vx[i][tx[i]];
      tx[i]++;
      if (id(y[id_]) <= i) {
        update(1, tot, 1, 1, id(y[id_]), c[id_]);
      } else {
        break;
      }
    }
    while (ty[i] < vy[i].size()) {
      int id_ = vy[i][ty[i]];
      ty[i]++;
      if (id(x[id_]) < i) {
        update(1, tot, 1, 1, id(x[id_]), c[id_]);
      } else {
        break;
      }
    }
    Nod tmp = query(1, tot, 1, 1, i);
    if (tmp.mx > ans) {
      ans = tmp.mx;
      ay = v[i - 1];
      ax = v[tmp.pos - 1];
    }
  }
  if (ans < 0) {
    for (int i = 1;; i++) {
      if (mp[i] == 0) {
        printf("0\n%d %d %d %d", i, i, i, i);
        return 0;
      }
    }
  }
  printf("%lld\n%lld %lld %lld %lld\n", ans, ax, ax, ay, ay);
}