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 inf = 2e9;
template <typename T>
inline T read() {
  T sum = 0, fl = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = -1;
  for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
  return sum * fl;
}
const int maxn = 1e6 + 5;
int n, mx;
pair<int, int> id;
struct Node {
  int first, second, w;
} o[maxn];
int li[maxn];
long long ans;
bool operator<(const Node& a, const Node& b) { return a.second < b.second; }
namespace SEG {
pair<long long, int> tr[maxn << 2];
long long tag[maxn << 2];
inline pair<long long, int> Merge(const pair<long long, int>& a,
                                  const pair<long long, int>& b) {
  return a.first > b.first ? a : b;
}
inline void pushdown(int rt) {
  if (!tag[rt]) return;
  tr[(rt << 1)].first += tag[rt];
  tr[(rt << 1 | 1)].first += tag[rt];
  tag[(rt << 1)] += tag[rt];
  tag[(rt << 1 | 1)] += tag[rt];
  tag[rt] = 0;
}
void build(int rt, int l, int r) {
  if (l == r) return (void)(tr[rt] = make_pair(li[l], l));
  build((rt << 1), l, ((l + r) >> 1));
  build((rt << 1 | 1), ((l + r) >> 1) + 1, r);
  tr[rt] = Merge(tr[(rt << 1)], tr[(rt << 1 | 1)]);
}
void update(int rt, int l, int r, int ql, int qr, int v) {
  if (l >= ql && r <= qr) return (void)(tr[rt].first += v, tag[rt] += v);
  pushdown(rt);
  if (((l + r) >> 1) >= ql) update((rt << 1), l, ((l + r) >> 1), ql, qr, v);
  if (((l + r) >> 1) < qr)
    update((rt << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr, v);
  tr[rt] = Merge(tr[(rt << 1)], tr[(rt << 1 | 1)]);
}
pair<long long, int> query(int rt, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) return tr[rt];
  pair<long long, int> ans = make_pair(0, 0);
  pushdown(rt);
  if (((l + r) >> 1) >= ql)
    ans = Merge(ans, query((rt << 1), l, ((l + r) >> 1), ql, qr));
  if (((l + r) >> 1) < qr)
    ans = Merge(ans, query((rt << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr));
  return ans;
}
}  // namespace SEG
void Solve() {
  n = read<int>();
  ans = 0;
  id = make_pair(2e9, 2e9);
  for (int i = 1; i <= n; ++i)
    o[i].first = read<int>(), o[i].second = read<int>(), o[i].w = read<int>();
  for (int i = 1; i <= n; ++i) li[i] = o[i].first, li[i + n] = o[i].second;
  sort(li + 1, li + n + n + 1);
  mx = unique(li + 1, li + n + n + 1) - li - 1;
  for (int i = 1; i <= n; ++i) {
    int first = min(o[i].first, o[i].second),
        second = max(o[i].first, o[i].second);
    o[i].first = lower_bound(li + 1, li + mx + 1, first) - li;
    o[i].second = lower_bound(li + 1, li + mx + 1, second) - li;
  }
  sort(o + 1, o + n + 1);
  SEG ::build(1, 1, mx);
  for (int i = 1; i <= n;) {
    do {
      SEG ::update(1, 1, mx, 1, o[i].first, o[i].w);
      ++i;
    } while (i <= n && o[i].second == o[i - 1].second);
    pair<long long, int> now = SEG ::query(1, 1, mx, 1, o[i - 1].second);
    int r = o[i - 1].second;
    if (now.first - li[r] > ans && now.second)
      ans = now.first - li[r], id = make_pair(li[now.second], li[r]);
  }
  printf("%lld\n%d %d %d %d\n", ans, id.first, id.first, id.second, id.second);
}
int main() {
  Solve();
  return 0;
}