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 long long INF = 0x3f3f3f3f;
struct Node {
  int x, y, c;
  int val() const { return min(x, y); }
  int lav() const { return max(x, y); }
  bool operator<(const Node &A) const { return val() < A.val(); }
} a[500010];
vector<int> all;
pair<long long, int> operator+(const pair<long long, int> &A,
                               const long long &x) {
  return make_pair(A.first + x, A.second);
}
struct Segment_tree {
  pair<long long, int> T[2100000];
  long long tag[2100000];
  void Build(int now, int l, int r) {
    tag[now] = 0;
    if (l == r) {
      T[now] = make_pair(-INF, all[l]);
      return;
    }
    int mid = l + r >> 1;
    Build(now << 1, l, mid), Build(now << 1 | 1, mid + 1, r);
    T[now] = max(T[now << 1], T[now << 1 | 1]) + tag[now];
  }
  void Update(int now, int l, int r, int L, int R, int x) {
    if (l == L && r == R) {
      T[now] = T[now] + x, tag[now] += x;
      return;
    }
    int mid = l + r >> 1;
    if (R <= mid)
      Update(now << 1, l, mid, L, R, x);
    else if (L > mid)
      Update(now << 1 | 1, mid + 1, r, L, R, x);
    else
      Update(now << 1, l, mid, L, mid, x),
          Update(now << 1 | 1, mid + 1, r, mid + 1, R, x);
    T[now] = max(T[now << 1], T[now << 1 | 1]) + tag[now];
  }
  pair<long long, int> Query() { return T[1]; }
} seg;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].c);
    all.push_back(a[i].x);
    all.push_back(a[i].y);
  }
  all.push_back(-1);
  sort(all.begin(), all.end()),
      all.resize(unique(all.begin(), all.end()) - all.begin());
  for (int i = 0; i < n; i++) {
    a[i].x = lower_bound(all.begin(), all.end(), a[i].x) - all.begin();
    a[i].y = lower_bound(all.begin(), all.end(), a[i].y) - all.begin();
  }
  int N = (int)all.size() - 1;
  sort(a, a + n);
  seg.Build(1, 1, N);
  long long ans = 0;
  int L = 2000000000, R = 2000000000;
  int p = N;
  for (int i = n - 1; i >= 0; i--) {
    int j = i;
    while (j >= 0 && a[j].val() == a[i].val()) {
      seg.Update(1, 1, N, a[j].lav(), N, a[j].c);
      j--;
    }
    while (p >= a[i].val()) seg.Update(1, 1, N, p, p, INF - all[p]), p--;
    if (ans < seg.Query().first + all[a[i].val()]) {
      ans = seg.Query().first + all[a[i].val()];
      L = all[a[i].val()], R = seg.Query().second;
    }
    i = j + 1;
  }
  printf("%I64d\n", ans);
  printf("%d %d %d %d\n", L, L, R, R);
  return 0;
}