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 double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 1000000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
inline int read() {
  int f = 0, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x = f ? -x : x;
}
int n, cnt;
int pos[maxn << 2];
vector<pair<int, int> > vec[maxn];
long long mx[maxn << 2], lazy[maxn << 2];
int num[maxn], x[maxn], y[maxn], c[maxn];
void push_up(int rt) {
  mx[rt] = max(mx[(rt << 1)], mx[(rt << 1 | 1)]);
  if (mx[(rt << 1)] >= mx[(rt << 1 | 1)])
    pos[rt] = pos[(rt << 1)];
  else
    pos[rt] = pos[(rt << 1 | 1)];
}
void push_down(int rt) {
  lazy[(rt << 1)] += lazy[rt];
  lazy[(rt << 1 | 1)] += lazy[rt];
  mx[(rt << 1)] += lazy[rt];
  mx[(rt << 1 | 1)] += lazy[rt];
  lazy[rt] = 0;
}
void build(int rt, int l, int r) {
  if (l == r) {
    pos[rt] = l, mx[rt] = -(num[l] - num[1]);
    return;
  }
  int mid = (l + r) >> 1;
  build((rt << 1), l, mid), build((rt << 1 | 1), mid + 1, r);
  push_up(rt);
}
void update(int rt, int l, int r, int L, int R, int val) {
  if (l == L && R == r) {
    mx[rt] += val;
    lazy[rt] += val;
    return;
  }
  push_down(rt);
  int mid = (l + r) >> 1;
  if (R <= mid)
    update((rt << 1), l, mid, L, R, val);
  else if (L > mid)
    update((rt << 1 | 1), mid + 1, r, L, R, val);
  else {
    update((rt << 1), l, mid, L, mid, val);
    update((rt << 1 | 1), mid + 1, r, mid + 1, R, val);
  }
  push_up(rt);
}
pair<long long, int> query(int rt, int l, int r, int L, int R) {
  if (l == L && R == r) {
    return make_pair(mx[rt], pos[rt]);
  }
  push_down(rt);
  int mid = (l + r) >> 1;
  if (R <= mid)
    return query((rt << 1), l, mid, L, R);
  else if (L > mid)
    return query((rt << 1 | 1), mid + 1, r, L, R);
  else {
    pair<long long, int> tmp1 = query((rt << 1), l, mid, L, mid),
                         tmp2 = query((rt << 1 | 1), mid + 1, r, mid + 1, R);
    if (tmp1.first >= tmp2.first)
      return tmp1;
    else
      return tmp2;
  }
}
int getid(int x) { return lower_bound(num + 1, num + cnt + 1, x) - num; }
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    x[i] = read(), y[i] = read(), c[i] = read();
    if (x[i] > y[i]) swap(x[i], y[i]);
    num[++cnt] = x[i], num[++cnt] = y[i];
  }
  sort(num + 1, num + cnt + 1);
  cnt = unique(num + 1, num + cnt + 1) - num - 1;
  build(1, 1, cnt);
  for (int i = 1; i <= n; ++i) {
    x[i] = getid(x[i]), y[i] = getid(y[i]);
    vec[x[i]].emplace_back(y[i], c[i]);
    update(1, 1, cnt, y[i], cnt, c[i]);
  }
  long long sum = 0;
  int ans1 = 2e9, ans2 = 2e9;
  for (int i = 1; i <= cnt; ++i) {
    pair<long long, int> tmp = query(1, 1, cnt, i, cnt);
    if (tmp.first > sum) {
      sum = tmp.first;
      ans1 = num[i], ans2 = num[tmp.second];
    }
    for (auto x : vec[i]) {
      update(1, 1, cnt, x.first, cnt, -x.second);
    }
    if (i < cnt) update(1, 1, cnt, i + 1, cnt, num[i + 1] - num[i]);
  }
  printf("%lld\n%d %d %d %d\n", sum, ans1, ans1, ans2, ans2);
  return 0;
}