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 = 5e5 + 10;
const int inf = 0x3f3f3f3f;
struct node {
  int x, y;
  long long c;
  node() {}
  node(int x, int y, long long c) : x(x), y(y), c(c) {}
  bool operator<(const node &n1) const { return x < n1.x; }
} p[maxn];
pair<long long, long long> sum[maxn << 2];
long long lz[maxn << 2];
int b[maxn];
int tot = 0;
inline int get_id(int x) { return lower_bound(b + 1, b + 1 + tot, x) - b; }
inline void pushup(int rt) { sum[rt] = max(sum[rt << 1], sum[rt << 1 | 1]); }
inline void pushdown(int rt) {
  if (lz[rt]) {
    sum[rt << 1].first += lz[rt];
    sum[rt << 1 | 1].first += lz[rt];
    lz[rt << 1] += lz[rt];
    lz[rt << 1 | 1] += lz[rt];
    lz[rt] = 0;
  }
}
void build(int l, int r, int rt) {
  lz[rt] = 0;
  if (l == r) {
    sum[rt] = {-b[l], b[l]};
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  pushup(rt);
}
void update(int rt, int l, int r, int p, int c) {
  if (p <= b[l]) {
    sum[rt].first += c;
    lz[rt] += c;
    return;
  }
  pushdown(rt);
  int mid = l + r >> 1;
  if (p <= b[mid]) update(rt << 1, l, mid, p, c);
  update(rt << 1 | 1, mid + 1, r, p, c);
  pushup(rt);
}
pair<long long, long long> query(int rt, int l, int r, int L, int R) {
  if (L > b[r]) return {-inf, 0};
  if (L <= b[l]) return sum[rt];
  pushdown(rt);
  int mid = l + r >> 1;
  pair<long long, long long> res =
      max(query(rt << 1, l, mid, L, R), query(rt << 1 | 1, mid + 1, r, L, R));
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].x >> p[i].y >> p[i].c;
    if (p[i].x > p[i].y) swap(p[i].x, p[i].y);
    b[++tot] = p[i].y;
  }
  sort(b + 1, b + 1 + tot);
  tot = unique(b + 1, b + 1 + tot) - b - 1;
  build(1, tot, 1);
  sort(p + 1, p + 1 + n);
  p[0].x = -1;
  pair<long long, long long> ans = {-inf, 0};
  int ansx;
  for (int i = n; i >= 1; i--) {
    update(1, 1, tot, p[i].y, p[i].c);
    if (p[i - 1].x != p[i].x) {
      pair<long long, long long> ret = query(1, 1, tot, p[i].x, tot);
      ret.first += p[i].x;
      if (ret > ans) {
        ans = ret;
        ansx = p[i].x;
      }
    }
  }
  if (ans.first < 0) {
    ans = {0, 1000000001}, ansx = 1000000001;
  }
  cout << ans.first << "\n"
       << ansx << " " << ansx << " " << ans.second << " " << ans.second << endl;
  return 0;
}