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;
int n;
int X[500005], Y[500005], C[500005];
vector<int> V;
vector<pair<int, int> > event[1000005];
long long dat[4000005], tag[4000005];
int N;
inline void pushdown(int v) {
  if (tag[v]) {
    dat[v << 1] += tag[v];
    dat[v << 1 | 1] += tag[v];
    tag[v << 1] += tag[v];
    tag[v << 1 | 1] += tag[v];
    tag[v] = 0;
  }
}
inline void update(int a, int b, int val, int v = 1, int l = 1, int r = N) {
  if (a <= l && r <= b)
    dat[v] += val, tag[v] += val;
  else if (b < l || r < a)
    return;
  else {
    int m = l + r >> 1;
    pushdown(v);
    update(a, b, val, v << 1, l, m);
    update(a, b, val, v << 1 | 1, m + 1, r);
    dat[v] = max(dat[v << 1], dat[v << 1 | 1]);
  }
}
inline int query(int v = 1, int l = 1, int r = N) {
  if (l == r)
    return l;
  else {
    int m = l + r >> 1;
    if (dat[v << 1] > dat[v << 1 | 1])
      return query(v << 1, l, m);
    else
      return query(v << 1 | 1, m + 1, r);
  }
}
const int INF = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= (n); ++i) {
    cin >> X[i] >> Y[i] >> C[i];
    V.push_back(X[i]);
    V.push_back(Y[i]);
  }
  sort(V.begin(), V.end());
  V.erase(unique(V.begin(), V.end()), V.end());
  N = V.size();
  for (int i = 1; i <= (n); ++i) {
    if (X[i] > Y[i]) {
      event[lower_bound(V.begin(), V.end(), Y[i]) - V.begin() + 1].push_back(
          make_pair(lower_bound(V.begin(), V.end(), X[i]) - V.begin() + 1,
                    C[i]));
    } else {
      event[lower_bound(V.begin(), V.end(), X[i]) - V.begin() + 1].push_back(
          make_pair(lower_bound(V.begin(), V.end(), Y[i]) - V.begin() + 1,
                    C[i]));
    }
  }
  long long ans = 0, DL, UR;
  for (int i = N; i >= 1; --i) {
    if (i < N) update(i + 1, N, V[i - 1] - V[i]);
    for (int j = 0; j < event[i].size(); ++j) {
      update(event[i][j].first, N, event[i][j].second);
    }
    if (dat[1] > ans) {
      ans = dat[1];
      DL = i;
      UR = query();
    }
  }
  if (ans == 0)
    printf("0\n%d %d %d %d\n", INF, INF, INF, INF);
  else {
    printf("%lld\n", ans);
    printf("%d %d %d %d", V[DL - 1], V[DL - 1], V[UR - 1], V[UR - 1]);
  }
  return 0;
}