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 dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const long long linf = 4000000000000000000LL;
const long long inf = 1000000007;
const long double pi = 3.1415926535;
void pv(vector<int> a) {
  for (auto& x : a) cout << x << " ";
  cout << '\n';
}
void pv(vector<long long> a) {
  for (auto& x : a) cout << x << " ";
  cout << '\n';
}
void pv(vector<vector<int>> a) {
  for (int i = (0); i < (int(a.size())); ++i) {
    cout << i << '\n';
    pv(a[i]);
    cout << '\n';
  }
}
void pv(vector<vector<long long>> a) {
  for (int i = (0); i < (int(a.size())); ++i) {
    cout << i << '\n';
    pv(a[i]);
  }
  cout << '\n';
}
void pv(vector<string> a) {
  for (auto& x : a) cout << x << '\n';
  cout << '\n';
}
void setIO(string second) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (int(second.size())) {
    freopen((second + ".out").c_str(), "r", stdin);
    if (second != "test1") freopen((second + ".in").c_str(), "w", stdout);
  }
}
vector<int> order;
class segment_tree {
  struct item {
    long long sum;
    long long prefix;
  };
  item single(long long i) { return {i, i}; }
  item merge(item x, item y) {
    item ans = {0, 0};
    ans.sum = x.sum + y.sum;
    ans.prefix = max(x.prefix, x.sum + y.prefix);
    return ans;
  }
  vector<item> tree;
  vector<item> A;
  int height;
  item neutral = {0, -linf};

 public:
  void build(vector<long long>& B) {
    int n = B.size();
    height = log2(n + 1) + 1;
    A.resize(n);
    tree.resize((1 << height + 1) - 1);
    for (int i = (0); i < (n); ++i) A[i] = single(B[i]);
    A.resize(1 << height, neutral);
    build(A, 0, 0, (1 << height) - 1);
  }
  void build(vector<item>& A, int v, int tl, int tr) {
    if (tl == tr)
      tree[v] = A[tl];
    else {
      int mid = (tl + tr) / 2;
      build(A, 2 * v + 1, tl, mid);
      build(A, 2 * v + 2, mid + 1, tr);
      tree[v] = merge(tree[2 * v + 1], tree[2 * v + 2]);
    }
  }

 public:
  long long query(int l, int r) {
    return query(0, 0, (1 << height) - 1, l, r).prefix;
  }
  item query(int v, int tl, int tr, int l, int r) {
    if (r < tl || l > tr) return neutral;
    if (l <= tl && r >= tr) {
      return tree[v];
    }
    int mid = (tl + tr) / 2;
    return merge(query(2 * v + 1, tl, mid, l, r),
                 query(2 * v + 2, mid + 1, tr, l, r));
  }

 public:
  void update(int pos, long long val) {
    update(0, 0, (1 << height) - 1, pos, single(val));
  }
  void update(int v, int tl, int tr, int pos, item val) {
    if (tl == tr) {
      tree[v] = val;
    } else {
      int mid = (tl + tr) / 2;
      if (pos <= mid)
        update(2 * v + 1, tl, mid, pos, val);
      else
        update(2 * v + 2, mid + 1, tr, pos, val);
      tree[v] = merge(tree[2 * v + 1], tree[2 * v + 2]);
    }
  }
};
struct range {
  int r, val;
};
int main() {
  setIO("");
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int>> t;
  set<int> tempo;
  for (int i = (0); i < (n); ++i) {
    int x, y, z;
    cin >> x >> y >> z;
    if (x > y) swap(x, y);
    order.push_back(x);
    order.push_back(y);
    t.push_back({{x, y}, z});
  }
  sort(order.begin(), order.end());
  for (auto& x : order) tempo.insert(x);
  order.clear();
  for (auto& x : tempo) order.push_back(x);
  vector<vector<range>> a(int(order.size()));
  for (auto& x : t)
    x.first.first =
        lower_bound(order.begin(), order.end(), x.first.first) - order.begin(),
    x.first.second =
        lower_bound(order.begin(), order.end(), x.first.second) - order.begin();
  for (auto& x : t) a[x.first.first].push_back({x.first.second, x.second});
  long long ans = 0;
  segment_tree sum;
  vector<long long> temp(int(order.size()));
  temp[0]--;
  for (int i = (0); i < (int(order.size()) - 1); ++i)
    temp[i + 1] -= order[i + 1] - order[i];
  for (auto& x : a)
    for (auto& y : x) temp[y.r] += y.val;
  sum.build(temp);
  int index = -1;
  for (int i = (0); i < (int(order.size())); ++i) {
    long long val = sum.query(i, int(order.size()) - 1) +
                    (i == 0 ? 1 : order[i] - order[i - 1]);
    if (val > ans) {
      ans = max(ans, val);
      index = i;
    }
    for (auto& x : a[i]) {
      temp[x.r] -= x.val;
      sum.update(x.r, temp[x.r]);
    }
  }
  cout << ans << '\n';
  if (ans == 0) {
    int x = 1231321231;
    cout << x << " " << x << " " << x << " " << x << '\n';
    return 0;
  }
  fill(temp.begin(), temp.end(), 0);
  temp[0]--;
  for (int i = (0); i < (int(order.size()) - 1); ++i)
    temp[i + 1] -= order[i + 1] - order[i];
  for (auto& x : a)
    for (auto& y : x) temp[y.r] += y.val;
  for (int i = (0); i < (index); ++i) {
    for (auto& x : a[i]) {
      temp[x.r] -= x.val;
    }
  }
  int j = index;
  long long cur = (index == 0 ? 1 : order[index] - order[index - 1]);
  for (; j < int(order.size()); j++) {
    cur += temp[j];
    if (cur == ans) break;
  }
  cout << order[index] << " " << order[index] << " " << order[j] << " "
       << order[j] << '\n';
}