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 max_n = 500555, inf = 1000111222;
struct tree {
  pair<long long, int> a[8 * max_n];
  long long f[8 * max_n];
  void build(int v, int l, int r) {
    if (l == r) {
      a[v] = {0, l};
      f[v] = 0;
      return;
    }
    int mid = (l + r) / 2;
    build(2 * v, l, mid);
    build(2 * v + 1, mid + 1, r);
    a[v] = max(a[2 * v], a[2 * v + 1]);
  }
  void push(int v, int l, int r) {
    if (f[v] != 0) {
      f[2 * v] += f[v];
      f[2 * v + 1] += f[v];
      a[2 * v].first += f[v];
      a[2 * v + 1].first += f[v];
      f[v] = 0;
    }
  }
  void update(int v, int tl, int tr, int l, int r, int value) {
    if (tl == l && tr == r) {
      f[v] += value;
      a[v].first += value;
      return;
    }
    push(v, tl, tr);
    int mid = (tl + tr) / 2;
    if (r <= mid) {
      update(2 * v, tl, mid, l, r, value);
    } else if (l > mid) {
      update(2 * v + 1, mid + 1, tr, l, r, value);
    } else {
      update(2 * v, tl, mid, l, mid, value);
      update(2 * v + 1, mid + 1, tr, mid + 1, r, value);
    }
    a[v] = max(a[2 * v], a[2 * v + 1]);
  }
  pair<long long, int> get_max(int v, int tl, int tr, int l, int r) {
    if (tl == l && tr == r) {
      return a[v];
    }
    push(v, tl, tr);
    int mid = (tl + tr) / 2;
    if (r <= mid) {
      return get_max(2 * v, tl, mid, l, r);
    }
    if (l > mid) {
      return get_max(2 * v + 1, mid + 1, tr, l, r);
    }
    return max(get_max(2 * v, tl, mid, l, mid),
               get_max(2 * v + 1, mid + 1, tr, mid + 1, r));
  }
};
struct point {
  int x, y, c, l, r;
  void read() {
    scanf("%d%d%d", &x, &y, &c);
    l = min(x, y);
    r = max(x, y);
  }
  bool operator<(const point &p) const { return l > p.l; }
};
int n;
point p[max_n];
vector<int> v;
tree t;
int compress(int x) { return lower_bound(v.begin(), v.end(), x) - v.begin(); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    p[i].read();
    v.push_back(p[i].l);
    v.push_back(p[i].r);
  }
  sort(p, p + n);
  sort(v.begin(), v.end());
  v.push_back(inf);
  v.erase(unique(v.begin(), v.end()), v.end());
  const int sz = v.size() - 1;
  t.build(1, 0, sz);
  for (int i = 0; i < v.size(); ++i) {
    t.update(1, 0, sz, i, i, -v[i]);
  }
  long long ans = 0;
  int l = inf, r = inf;
  for (int i = 0; i < n;) {
    int pos = i;
    while (i < n && p[i].l == p[pos].l) {
      t.update(1, 0, sz, compress(p[i].r), sz, p[i].c);
      ++i;
    }
    auto mx = t.get_max(1, 0, sz, compress(p[pos].l), sz);
    long long res = mx.first + p[pos].l;
    if (ans < res) {
      ans = res;
      l = p[pos].l;
      r = v[mx.second];
    }
  }
  printf("%I64d\n%d %d %d %d\n", ans, l, l, r, r);
  return 0;
}