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 N = 5e5 + 5;
const int M = N * 4;
const int INF = 2000000000;
const long long LINF = 100000000000000000ll;
int n, m = 1, t;
pair<long long, pair<int, int> > ans =
    pair<long long, pair<int, int> >(0ll, pair<int, int>(INF, INF));
int X[N], Y[N], C[N];
int num[N * 2];
int lson[M], rson[M];
long long tag[M];
pair<long long, int> val[M];
vector<int> ope[N * 2];
map<int, int> mp;
pair<long long, int> SUM(int pos) {
  return pair<long long, int>(val[pos].first + tag[pos], val[pos].second);
}
void pushdown(int pos) {
  tag[lson[pos]] += tag[pos];
  tag[rson[pos]] += tag[pos];
  tag[pos] = 0ll;
}
void update(int pos) { val[pos] = max(SUM(lson[pos]), SUM(rson[pos])); }
void build(int pos, int x, int y) {
  if (x == y) {
    val[pos] = make_pair(1ll * num[x], x);
    return;
  }
  int mid = (x + y) >> 1;
  build(lson[pos] = ++m, x, mid);
  build(rson[pos] = ++m, mid + 1, y);
  update(pos);
}
void modify(int pos, int x, int y, int l, int r, int v) {
  if (x >= l && y <= r) {
    tag[pos] += 1ll * v;
    return;
  }
  if (x > r || y < l) return;
  pushdown(pos);
  int mid = (x + y) >> 1;
  modify(lson[pos], x, mid, l, r, v);
  modify(rson[pos], mid + 1, y, l, r, v);
  update(pos);
}
pair<long long, int> query(int pos, int x, int y, int l, int r) {
  if (x >= l && y <= r) return SUM(pos);
  if (x > r || y < l) return pair<long long, int>(-1ll * LINF, 0);
  pushdown(pos);
  int mid = (x + y) >> 1;
  pair<long long, int> ret =
      max(query(lson[pos], x, mid, l, r), query(rson[pos], mid + 1, y, l, r));
  update(pos);
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", X + i, Y + i, C + i);
    mp[X[i]];
    mp[Y[i]];
  }
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    num[it->second = ++t] = it->first;
  for (int i = 1; i <= n; i++) {
    X[i] = mp[X[i]];
    Y[i] = mp[Y[i]];
    if (X[i] > Y[i]) swap(X[i], Y[i]);
    ope[Y[i]].push_back(i);
  }
  build(1, 1, t);
  for (int i = 1; i <= t; i++) {
    for (int j = 0; j < int(ope[i].size()); j++) {
      int x = ope[i][j];
      modify(1, 1, t, 1, X[x], C[x]);
    }
    pair<long long, int> qr = query(1, 1, t, 1, i);
    qr.first -= 1ll * num[i];
    ans = max(ans, pair<long long, pair<int, int> >(
                       qr.first, pair<int, int>(num[qr.second], num[i])));
  }
  printf("%lld\n%d %d %d %d\n", ans.first, ans.second.first, ans.second.first,
         ans.second.second, ans.second.second);
  return 0;
}