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>
#include <bits/stdc++.h>
using namespace std;
template <class T>
void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (argc > 1) {
    static filebuf f;
    f.open(argv[1], ios::in);
    cin.rdbuf(&f);
    if (!cin) {
      cerr << "Failed to open '" << argv[1] << "'" << endl;
      exit(1);
    }
  }
  if (argc > 2) {
    static filebuf f;
    f.open(argv[2], ios::out | ios::trunc);
    cout.rdbuf(&f);
    if (!cout) {
      cerr << "Failed to open '" << argv[2] << "'" << endl;
    }
  }
  cin.exceptions(ios::failbit);
}
template <typename Node>
class SegmentTree {
 public:
 private:
  std::size_t N;
  std::size_t offset;
  mutable std::vector<Node> nodes;
  void push_down(std::size_t idx, int L, int R) const {
    if (idx < offset)
      nodes[idx].push_down(L, R, nodes[2 * idx], nodes[2 * idx + 1]);
  }
  template <typename Op>
  auto query(std::size_t cur, std::size_t L, std::size_t R, std::size_t A,
             std::size_t B, const Op &op) const
      -> decltype(nodes[0].query(L, R, op)) {
    assert(A < R && B > L && A < B);
    if (A <= L && B >= R)
      return nodes[cur].query(L, R, op);
    else {
      std::size_t M = (L + R) / 2;
      push_down(cur, L, R);
      if (B <= M)
        return query(2 * cur, L, M, A, B, op);
      else if (A >= M)
        return query(2 * cur + 1, M, R, A, B, op);
      else {
        auto left = query(2 * cur, L, M, A, B, op);
        auto right = query(2 * cur + 1, M, R, A, B, op);
        return op(left, right);
      }
    }
  }
  template <typename T, typename Op>
  void apply(std::size_t cur, std::size_t L, std::size_t R, std::size_t A,
             std::size_t B, const T &value, const Op &op) {
    assert(A < R && B > L && A < B);
    push_down(cur, L, R);
    if (A <= L && B >= R)
      nodes[cur].apply(L, R, value, op);
    else {
      std::size_t M = (L + R) / 2;
      if (A < M) apply(2 * cur, L, M, A, B, value, op);
      if (B > M) apply(2 * cur + 1, M, R, A, B, value, op);
      nodes[cur].update(L, R, nodes[2 * cur], nodes[2 * cur + 1]);
    }
  }
  void prepare(std::size_t N) {
    this->N = N;
    offset = 1;
    while (offset < N) offset *= 2;
    nodes.resize(2 * offset);
  }
  void pull_up() {
    for (std::size_t i = 0; i < offset; i++) nodes[i + offset].init(i);
    for (std::size_t step = 2; step <= offset; step <<= 1) {
      int base = offset / step;
      for (int i = base; i < base * 2; i++)
        nodes[i].update(i * step, (i + 1) * step, nodes[2 * i],
                        nodes[2 * i + 1]);
    }
  }

 public:
  explicit SegmentTree(std::size_t N) {
    prepare(N);
    pull_up();
  }
  std::size_t size() const { return N; }
  template <typename Op>
  auto query(std::size_t a, std::size_t b, const Op &op = Op()) const
      -> decltype(query(1, 0, offset, a, b, op)) {
    assert(a < b && b <= N);
    return query(1, 0, offset, a, b, op);
  }
  template <typename T, typename Op>
  void apply(std::size_t a, std::size_t b, const T &value,
             const Op &op = Op()) {
    assert(a <= b && b <= N);
    if (a < b) apply(1, 0, offset, a, b, value, op);
  }
};
template <typename T>
class op_max {
 public:
  T operator()(const T &a, const T &b) const { return std::max(a, b); }
};
template <typename T>
struct add_max {
  T add{};
  T max{};
  size_t max_pos{};
  void push_down(size_t L, size_t R, add_max &left, add_max &right) {
    left.add += add;
    left.max += add;
    right.add += add;
    right.max += add;
    add = T();
  }
  void update(size_t L, size_t R, const add_max &left, const add_max &right) {
    assert(add == T());
    max = std::max(left.max, right.max);
    if (right.max > left.max)
      max_pos = right.max_pos;
    else
      max_pos = left.max_pos;
  }
  void apply(size_t L, size_t R, const T &value, const std::plus<T> &op) {
    add += value;
    max += value;
  }
  pair<T, size_t> query(size_t L, size_t R,
                        const op_max<pair<T, size_t>> &op) const {
    return make_pair(max, max_pos);
  }
  void init(size_t pos) { max_pos = pos; }
  add_max() = default;
  explicit add_max(const T &value) : add(value), max(value) {}
};
struct pnt {
  long long x, y, c;
  bool operator<(const pnt &other) const { return x < other.x; }
};
int main(int argc, const char **argv) {
  redirect(argc, argv);
  int N;
  cin >> N;
  vector<pnt> pnts(N);
  map<long long, int> ys;
  for (int i = 0; i < N; i++) {
    cin >> pnts[i].x >> pnts[i].y >> pnts[i].c;
    if (pnts[i].x > pnts[i].y) swap(pnts[i].x, pnts[i].y);
    ys[pnts[i].x] = -1;
    ys[pnts[i].y] = -1;
  }
  sort(begin(pnts), end(pnts));
  int Y = ((long long)(ys).size());
  vector<long long> y;
  y.reserve(Y);
  for (auto &e : ys) {
    e.second = ((long long)(y).size());
    y.push_back(e.first);
  }
  SegmentTree<add_max<long long>> tree(Y);
  for (int i = 0; i < Y; i++) tree.apply(i, i + 1, -y[i], plus<long long>());
  int p = N;
  long long ans = 0;
  long long ans_x = 1000000001, ans_y = 1000000001;
  while (p > 0) {
    int q = p;
    long long x = pnts[q - 1].x;
    while (p > 0 && pnts[p - 1].x == x) p--;
    for (int i = p; i < q; i++)
      tree.apply(ys[pnts[i].y], Y, pnts[i].c, plus<long long>());
    auto score = tree.query(ys[x], Y, op_max<pair<long long, size_t>>());
    score.first += x;
    if (score.first > ans) {
      ans = score.first;
      ans_x = x;
      ans_y = y[score.second];
    }
  }
  cout << ans << '\n'
       << ans_x << ' ' << ans_x << ' ' << ans_y << ' ' << ans_y << '\n';
  return 0;
}
