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 maxn = 1200000 + 100;
const int maxm = 1300000 + 100;
const int maxt = 3000000 + 100;
const int maxk = 10 + 3;
const int M = 2010;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const long long Inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const double inf = 1e15;
const double pi = acos(-1.0);
const long long mod = 998244353LL, gg = 3LL, inv2 = 499122177LL;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
struct Interval {
  int l, r;
  long long c;
  bool operator<(const Interval &a) const {
    if (r == a.r) return l < a.l;
    return r < a.r;
  }
} a[maxn];
int n, tt, b[maxn << 1], Pos[maxn << 1];
long long w[maxn << 1], Max[maxn << 1], lazy[maxn << 1];
int bin(int x) { return lower_bound(b + 1, b + 1 + tt, x) - b; }
void PushUp(int rt) {
  if (Max[rt << 1] > Max[rt << 1 | 1])
    Max[rt] = Max[rt << 1], Pos[rt] = Pos[rt << 1];
  else
    Max[rt] = Max[rt << 1 | 1], Pos[rt] = Pos[rt << 1 | 1];
}
void PushDown(int rt) {
  if (lazy[rt]) {
    Max[rt << 1] += lazy[rt], Max[rt << 1 | 1] += lazy[rt];
    lazy[rt << 1] += lazy[rt], lazy[rt << 1 | 1] += lazy[rt];
    lazy[rt] = 0;
  }
}
void Build(int l, int r, int rt) {
  if (l == r) {
    Max[rt] = w[l];
    Pos[rt] = l;
    return;
  }
  int m = (l + r) >> 1;
  Build(l, m, rt << 1), Build(m + 1, r, rt << 1 | 1);
  PushUp(rt);
}
void Add(int L, int R, long long x, int l, int r, int rt) {
  if (L <= l && r <= R) {
    Max[rt] += x;
    lazy[rt] += x;
    return;
  }
  PushDown(rt);
  int m = (l + r) >> 1;
  if (L <= m) Add(L, R, x, l, m, rt << 1);
  if (R > m) Add(L, R, x, m + 1, r, rt << 1 | 1);
  PushUp(rt);
}
long long Ask(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) return Max[rt];
  PushDown(rt);
  int m = (l + r) >> 1;
  long long ans = -Inf;
  if (L <= m) ans = max(ans, Ask(L, R, l, m, rt << 1));
  if (R > m) ans = max(ans, Ask(L, R, m + 1, r, rt << 1 | 1));
  PushUp(rt);
  return ans;
}
int AskPos(int L, int R, long long x, int l, int r, int rt) {
  if (L <= l && r <= R) {
    if (Max[rt] == x)
      return Pos[rt];
    else
      return INF;
  }
  int m = (l + r) >> 1;
  int ans = INF;
  if (L <= m) ans = min(ans, AskPos(L, R, x, l, m, rt << 1));
  if (R > m) ans = min(ans, AskPos(L, R, x, m + 1, r, rt << 1 | 1));
  return ans;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    a[i].l = read(), a[i].r = read(), a[i].c = read();
    b[++tt] = a[i].l, b[++tt] = a[i].r;
    if (a[i].l > a[i].r) swap(a[i].l, a[i].r);
  }
  sort(b + 1, b + 1 + tt);
  tt = unique(b + 1, b + 1 + tt) - b - 1;
  for (int i = 1; i <= n; ++i) a[i].l = bin(a[i].l), a[i].r = bin(a[i].r);
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) w[a[i].l] += a[i].c;
  for (int i = tt; i >= 1; --i) w[i] += w[i + 1];
  for (int i = tt; i >= 1; --i) w[i] += b[i];
  Build(1, tt, 1);
  int now = n;
  long long res = 0;
  int resx = b[tt] + 1, resy = b[tt] + 1;
  for (int ri = tt; ri >= 1; --ri) {
    while (now >= 1 && a[now].r > ri) {
      Add(1, a[now].l, -a[now].c, 1, tt, 1);
      --now;
    }
    if (!now) break;
    long long tmp = Ask(1, ri, 1, tt, 1);
    if (tmp - b[ri] > res) {
      res = tmp - b[ri];
      resx = b[AskPos(1, ri, tmp, 1, tt, 1)], resy = b[ri];
    }
  }
  printf("%lld\n", res);
  printf("%d %d %d %d\n", resx, resx, resy, resy);
  return 0;
}