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;
long long int LIM = 1e6 + 10;
long long int MAXI = 1e6 + 10;
vector<pair<long long int, int> > tree(2 * LIM + LIM / 2);
vector<long long int> lazy1(2 * LIM + LIM / 2);
pair<long long int, int> combine(pair<long long int, int> a,
                                 pair<long long int, int> b) {
  if (a.first > b.first)
    return a;
  else
    return b;
}
void build(int node, int start, int end) {
  if (start == end) {
    tree[node] = pair<long long int, int>(0, start);
    return;
  }
  int mid = (start + end) / 2;
  build(node * 2, start, mid);
  build(node * 2 + 1, mid + 1, end);
}
void updateRange(long long int node, long long int start, long long int end,
                 long long int l, long long int r, long long int val) {
  if (lazy1[node] != 0) {
    tree[node].first += lazy1[node];
    if (start != end) {
      lazy1[node * 2] += lazy1[node];
      lazy1[node * 2 + 1] += lazy1[node];
    }
    lazy1[node] = 0;
  }
  if (start > end or start > r or end < l) return;
  if (start >= l and end <= r) {
    tree[node].first += val;
    if (start != end) {
      lazy1[node * 2] += val;
      lazy1[node * 2 + 1] += val;
    }
    return;
  }
  long long int mid = (start + end) / 2;
  updateRange(node * 2, start, mid, l, r, val);
  updateRange(node * 2 + 1, mid + 1, end, l, r, val);
  tree[node] = combine(tree[node * 2], tree[node * 2 + 1]);
}
pair<long long int, int> queryRange(long long int node, long long int start,
                                    long long int end, long long int l,
                                    long long int r) {
  if (start > end or start > r or end < l)
    return pair<long long int, int>(-1e17, -1);
  if (lazy1[node] != 0) {
    tree[node].first += lazy1[node];
    if (start != end) {
      lazy1[node * 2] += lazy1[node];
      lazy1[node * 2 + 1] += lazy1[node];
    }
    lazy1[node] = 0;
  }
  if (start >= l and end <= r) return tree[node];
  long long int mid = (start + end) / 2;
  pair<long long int, int> p1 = queryRange(node * 2, start, mid, l, r);
  pair<long long int, int> p2 = queryRange(node * 2 + 1, mid + 1, end, l, r);
  return combine(p1, p2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<pair<pair<long long int, int>, int> > arr(n + 1);
  set<int> x, y;
  for (long long int i = 1; i <= n; i++) {
    cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second;
    arr[i].first.first++;
    arr[i].first.second++;
    x.insert(arr[i].first.first);
    y.insert(arr[i].first.second);
  }
  set<int> iterate;
  iterate.insert(MAXI);
  map<int, int> x1, y1;
  long long int x2 = 1, y2 = 1;
  for (auto it = x.begin(); it != x.end(); it++) {
    x1[*it] = x2++;
    iterate.insert(*it);
  }
  for (auto it = y.begin(); it != y.end(); it++) {
    y1[*it] = y2++;
    iterate.insert(*it);
  }
  vector<int> iter(1);
  map<int, int> pos;
  long long int counter2 = 1;
  for (auto it = iterate.begin(); it != iterate.end(); it++) {
    pos[*it] = counter2++;
    iter.push_back(*it);
  }
  vector<vector<long long int> > points(LIM);
  vector<long long int> maxi(LIM);
  for (long long int i = 1; i <= n; i++) {
    long long int x = arr[i].first.first;
    long long int y = arr[i].first.second;
    if (x < y) {
      points[pos[x]].push_back(i);
      maxi[i] = y;
    } else {
      points[pos[y]].push_back(i);
      maxi[i] = x;
    }
  }
  long long int num = (long long int)iter.size() - 1;
  long long int ans = 0;
  long long int x3 = 0, y3 = 0;
  while (points[pos[x3] + 1].size() > 0) {
    x3++;
    y3++;
  }
  MAXI = num;
  build(1, 1, MAXI);
  for (long long int i = num - 1; i >= 1; i--) {
    int val = iter[i] - iter[i + 1];
    updateRange(1, 1, MAXI, i + 1, MAXI, val);
    long long int X = iter[i];
    for (long long int j = 0; j < points[pos[X]].size(); j++) {
      long long int val = arr[points[pos[X]][j]].second;
      int y = maxi[points[pos[X]][j]];
      updateRange(1, 1, MAXI, pos[y], MAXI, val);
    }
    pair<long long int, int> temp = queryRange(1, 1, MAXI, i, MAXI);
    if (temp.first > ans) {
      ans = temp.first;
      x3 = iter[i] - 1;
      y3 = iter[temp.second] - 1;
    }
  }
  cout << ans << endl;
  cout << x3 << " " << x3 << " " << y3 << " " << y3 << endl;
  return 0;
}