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;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
void writep(long long x) {
  write(x);
  putchar(' ');
}
const long long N = 500005, inf = 1 << 30;
long long n, a[N], b[N], cnt, pos[N << 2], mx[N << 2], lazy[N << 2], ansx, ansy,
    MX;
struct info {
  long long x, y, w;
} p[N];
bool used[N];
bool cmp(info a, info b) { return a.x == b.x ? a.y > b.y : a.x < b.x; }
void upd(long long k) {
  mx[k] = max(mx[k << 1], mx[k << 1 | 1]);
  if (mx[k << 1] > mx[k << 1 | 1])
    pos[k] = pos[k << 1];
  else
    pos[k] = pos[k << 1 | 1];
}
void buildtree(long long k, long long l, long long r) {
  if (l == r) {
    mx[k] = pos[k] = b[l];
    return;
  }
  long long mid = l + r >> 1;
  buildtree(k << 1, l, mid);
  buildtree(k << 1 | 1, mid + 1, r);
  upd(k);
}
void add(long long k, long long x) {
  lazy[k] += x;
  mx[k] += x;
}
void pushdown(long long k) {
  if (!lazy[k]) return;
  add(k << 1, lazy[k]);
  add(k << 1 | 1, lazy[k]);
  lazy[k] = 0;
}
void change(long long k, long long l, long long r, long long L, long long R,
            long long x) {
  if (l >= L && r <= R) {
    add(k, x);
    return;
  }
  pushdown(k);
  long long mid = l + r >> 1;
  if (L <= mid) change(k << 1, l, mid, L, R, x);
  if (R > mid) change(k << 1 | 1, mid + 1, r, L, R, x);
  upd(k);
}
pair<long long, long long> merge(pair<long long, long long> x,
                                 pair<long long, long long> y) {
  return x.first > y.first ? x : y;
}
pair<long long, long long> find(long long k, long long l, long long r,
                                long long p) {
  if (l == r) return make_pair(mx[k], pos[k]);
  pushdown(k);
  long long mid = l + r >> 1;
  if (p <= mid) return find(k << 1, l, mid, p);
  return merge(make_pair(mx[k << 1], pos[k << 1]),
               find(k << 1 | 1, mid + 1, r, p));
}
signed main() {
  n = read();
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    long long x = read(), y = read(), w = read();
    if (y > x) swap(x, y);
    p[i] = (info){x, y, w};
    b[++cnt] = y;
    MX = max(MX, x);
  }
  sort(b + 1, b + cnt + 1);
  cnt = unique(b + 1, b + cnt + 1) - b - 1;
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    p[i].y = lower_bound(b + 1, b + cnt + 1, p[i].y) - b;
  sort(p + 1, p + n + 1, cmp);
  buildtree(1, 1, cnt);
  long long ans = -inf;
  for (long long i = 1, j = 1; i <= n; i = j) {
    while (j <= n && p[j].x == p[i].x) {
      if (p[j].w != 0) change(1, 1, cnt, 1, p[j].y, p[j].w);
      j++;
    }
    long long alb = upper_bound(b + 1, b + cnt + 1, p[i].x) - b - 1;
    pair<long long, long long> res = find(1, 1, cnt, alb);
    if (res.first - p[i].x > ans) {
      ansx = res.second;
      ansy = p[i].x;
      ans = res.first - p[i].x;
    }
  }
  if (ans < 0) {
    ans = 0;
    ansx = ansy = MX + 1;
  }
  cout << ans << endl << ansx << " " << ansx << " " << ansy << " " << ansy;
}