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 = 1000005;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
int n, sor[MAXN], tot;
struct Node {
  int x, y, c;
} p[MAXN];
vector<int> vec[MAXN];
long long tag[MAXN << 2];
pair<long long, int> seg[MAXN << 2];
inline void puttag(int rt, long long tg) {
  seg[rt].first += tg;
  tag[rt] += tg;
}
inline void pushdown(int rt) {
  if (tag[rt]) {
    puttag((rt << 1), tag[rt]);
    puttag((rt << 1) | 1, tag[rt]);
    tag[rt] = 0;
  }
}
void Build(int rt, int b, int e) {
  if (b == e) {
    seg[rt] = make_pair(sor[b], b);
    return;
  }
  int mid = (b + e) >> 1;
  Build((rt << 1), b, mid);
  Build((rt << 1) | 1, mid + 1, e);
  seg[rt] = max(seg[(rt << 1)], seg[(rt << 1) | 1]);
}
void Update(int rt, int b, int e, int l, int r, int v) {
  if (l <= b && e <= r) {
    puttag(rt, v);
    return;
  }
  int mid = (b + e) >> 1;
  pushdown(rt);
  if (l <= mid) Update((rt << 1), b, mid, l, r, v);
  if (r > mid) Update((rt << 1) | 1, mid + 1, e, l, r, v);
  seg[rt] = max(seg[(rt << 1)], seg[(rt << 1) | 1]);
}
pair<long long, int> Query(int rt, int b, int e, int r) {
  if (b == e) return seg[rt];
  int mid = (b + e) >> 1;
  pushdown(rt);
  if (r <= mid) return Query((rt << 1), b, mid, r);
  return max(seg[(rt << 1)], Query((rt << 1) | 1, mid + 1, e, r));
}
void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(p[i].x);
    read(p[i].y);
    read(p[i].c);
    if (p[i].x > p[i].y) swap(p[i].x, p[i].y);
    sor[++tot] = p[i].x;
    sor[++tot] = p[i].y;
  }
  sort(sor + 1, sor + tot + 1);
  tot = unique(sor + 1, sor + tot + 1) - (sor + 1);
  for (int i = 1; i <= n; ++i) {
    p[i].x = lower_bound(sor + 1, sor + tot + 1, p[i].x) - sor;
    p[i].y = lower_bound(sor + 1, sor + tot + 1, p[i].y) - sor;
    vec[p[i].y].push_back(i);
  }
}
void solve() {
  Build(1, 1, tot);
  long long ans = 0;
  int lx = 2e9, rx = 2e9;
  for (int i = 1; i <= tot; ++i) {
    for (auto j : vec[i]) {
      Update(1, 1, tot, 1, p[j].x, p[j].c);
    }
    pair<long long, int> pp = Query(1, 1, tot, i);
    if (ans < pp.first - sor[i]) {
      ans = pp.first - sor[i];
      lx = sor[pp.second];
      rx = sor[i];
    }
  }
  printf("%lld\n", ans);
  printf("%d %d %d %d\n", lx, lx, rx, rx);
}
int main() {
  init();
  solve();
  return 0;
}