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 = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 1000500;
int n, x[N], y[N], c[N], ansl, ansr, z[N], m;
vector<int> g[N];
long long tt[4 * N], ans;
pair<long long, int> t[4 * N];
map<int, int> M;
set<int> second;
void push(int v) {
  t[v + v].first += tt[v];
  tt[v + v] += tt[v];
  t[v + v + 1].first += tt[v];
  tt[v + v + 1] += tt[v];
  tt[v] = 0;
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    t[v].first = z[tl];
    t[v].second = tl;
    return;
  }
  int tm = (tl + tr) >> 1;
  build(v + v, tl, tm);
  build(v + v + 1, tm + 1, tr);
  if (t[v + v].first > t[v + v + 1].first)
    t[v] = t[v + v];
  else
    t[v] = t[v + v + 1];
}
void upd(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl == l && tr == r) {
    t[v].first += val;
    tt[v] += val;
    return;
  }
  push(v);
  int tm = (tl + tr) >> 1;
  upd(v + v, tl, tm, l, min(r, tm), val);
  upd(v + v + 1, tm + 1, tr, max(l, tm + 1), r, val);
  if (t[v + v].first > t[v + v + 1].first)
    t[v] = t[v + v];
  else
    t[v] = t[v + v + 1];
}
pair<long long, int> get(int v, int tl, int tr, int l, int r) {
  if (l > r) return make_pair(0, 0);
  if (tl == l && tr == r) return t[v];
  push(v);
  int tm = (tl + tr) >> 1;
  pair<long long, int> L = get(v + v, tl, tm, l, min(r, tm));
  pair<long long, int> R = get(v + v + 1, tm + 1, tr, max(l, tm + 1), r);
  if (L.first > R.first) return L;
  return R;
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i] >> c[i];
    second.insert(x[i]);
    second.insert(y[i]);
  }
  for (int i : second) {
    M[i] = ++m;
    z[m] = i;
  }
  build(1, 1, m);
  for (int i = 1; i <= n; ++i) {
    g[M[max(x[i], y[i])]].push_back(i);
  }
  for (int i = 1; i <= m; ++i) {
    for (int j : g[i]) upd(1, 1, m, 1, M[min(x[j], y[j])], c[j]);
    pair<long long, int> pr = get(1, 1, m, 1, i);
    if (pr.first - z[i] > ans) {
      ans = pr.first - z[i];
      ansl = pr.second, ansr = i;
    }
  }
  if (ans)
    ansl = z[ansl], ansr = z[ansr];
  else
    ansl = (int)2e9, ansr = (int)2e9;
  cout << ans << endl;
  cout << ansl << " " << ansl << " " << ansr << " " << ansr << endl;
  return 0;
}