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;
int tmp[1000010];
struct Tree {
  long long mx;
  int pos;
} T[4000010];
long long lazy[4000010];
Tree operator+(const Tree& a, const Tree& b) {
  if (a.mx > b.mx) return a;
  return b;
}
void update(int root) {
  T[root] = T[root << 1] + T[root << 1 | 1];
  return;
}
void pushdown(int root) {
  T[root << 1].mx += lazy[root];
  T[root << 1 | 1].mx += lazy[root];
  lazy[root << 1] += lazy[root];
  lazy[root << 1 | 1] += lazy[root];
  lazy[root] = 0;
  return;
}
void build(int root, int l, int r) {
  if (l == r) {
    T[root].pos = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(root << 1, l, mid);
  build(root << 1 | 1, mid + 1, r);
  update(root);
  return;
}
void add(int root, int l, int r, int x, int y, int z) {
  if (x <= l && r <= y) {
    T[root].mx += z;
    lazy[root] += z;
    return;
  }
  pushdown(root);
  int mid = (l + r) >> 1;
  if (x <= mid) add(root << 1, l, mid, x, y, z);
  if (y > mid) add(root << 1 | 1, mid + 1, r, x, y, z);
  update(root);
  return;
}
Tree query(int root, int l, int r, int x, int y) {
  if (x <= l && r <= y) return T[root];
  pushdown(root);
  int mid = (l + r) >> 1;
  if (x <= mid) {
    if (y > mid)
      return query(root << 1, l, mid, x, y) +
             query(root << 1 | 1, mid + 1, r, x, y);
    return query(root << 1, l, mid, x, y);
  }
  return query(root << 1 | 1, mid + 1, r, x, y);
}
struct Point {
  int x, y, c;
} p[500010];
bool cmp(Point a, Point b) { return a.y < b.y; }
long long ans = 0;
int ansx = 2e9, ansy = 2e9;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d", &p[i].x, &p[i].y, &p[i].c);
    tmp[i * 2 - 1] = p[i].x;
    tmp[i * 2] = p[i].y;
  }
  sort(tmp + 1, tmp + 2 * n + 1);
  int M = unique(tmp + 1, tmp + 2 * n + 1) - tmp - 1;
  for (int i = 1; i <= n; i++) {
    p[i].x = lower_bound(tmp + 1, tmp + M + 1, p[i].x) - tmp;
    p[i].y = lower_bound(tmp + 1, tmp + M + 1, p[i].y) - tmp;
    if (p[i].x > p[i].y) swap(p[i].x, p[i].y);
  }
  sort(p + 1, p + n + 1, cmp);
  int cur = 1;
  build(1, 1, M);
  for (int i = 1; i <= n; i++) {
    add(1, 1, M, 1, p[i].x, p[i].c);
    while (cur < p[i].y) {
      add(1, 1, M, 1, cur, tmp[cur] - tmp[cur + 1]);
      cur++;
    }
    if (i == n || p[i].y != p[i + 1].y) {
      Tree ret = query(1, 1, M, 1, p[i].y);
      if (ans < ret.mx) ans = ret.mx, ansx = ret.pos, ansy = p[i].y;
    }
  }
  printf("%I64d\n", ans);
  if (ansx <= M && ansy <= M) ansx = tmp[ansx], ansy = tmp[ansy];
  printf("%d %d %d %d\n", ansx, ansx, ansy, ansy);
  return 0;
}