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 JAVA):

Solution:
// practice with rainboy
import java.io.*;
import java.util.*;

public class CF1221F extends PrintWriter {
	CF1221F() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1221F o = new CF1221F(); o.main(); o.flush();
	}

	static final int INF = 2000000000;
	long[] amax, lz; int[] imax; int h_, n_;
	int[] xx, aa, ll, rr, cc;
	void put(int i, long c) {
		amax[i] += c;
		if (i < n_)
			lz[i] += c;
	}
	void pull1(int i) {
		int l = i << 1, r = l | 1;
		if (amax[l] >= amax[r]) {
			amax[i] = amax[l]; imax[i] = imax[l];
		} else {
			amax[i] = amax[r]; imax[i] = imax[r];
		}
	}
	void build(int n, int a) {
		h_ = 0;
		while (1 << h_ < a)
			h_++;
		n_ = 1 << h_;
		amax = new long[n_ * 2]; imax = new int[n_ * 2]; lz = new long[n_];
		for (int i = 0; i < n; i++) {
			int il = ll[i], ir = rr[i];
			int l = n_ + aa[il], r = n_ + aa[ir];
			amax[l] = xx[imax[l] = il];
			amax[r] = xx[imax[r] = ir];
		}
		for (int i = n_ - 1; i > 0; i--)
			pull1(i);
	}
	void push(int i) {
		for (int h = h_; h > 0; h--) {
			int a = i >> h;
			if (lz[a] != 0) {
				put(a << 1, lz[a]);
				put(a << 1 | 1, lz[a]);
				lz[a] = 0;
			}
		}
	}
	void pull(int i) {
		while (i > 1) {
			i >>= 1;
			if (lz[i] == 0)
				pull1(i);
		}
	}
	void update(int l, int r, int c) {
		int l_ = l += n_, r_ = r += n_;
		push(l_); push(r_);
		for ( ; l <= r; l >>= 1, r >>= 1) {
			if ((l & 1) == 1)
				put(l++, c);
			if ((r & 1) == 0)
				put(r--, c);
		}
		pull(l_); pull(r_);
	}
	int i_;
	long query(int l, int r) {
		push(l += n_); push(r += n_);
		long a_ = -INF;
		for ( ; l <= r; l >>= 1, r >>= 1) {
			if ((l & 1) == 1) {
				if (a_ < amax[l]) {
					a_ = amax[l]; i_ = imax[l];
				}
				l++;
			}
			if ((r & 1) == 0) {
				if (a_ < amax[r]) {
					a_ = amax[r]; i_ = imax[r];
				}
				r--;
			}
		}
		return a_;
	}
	void main() {
		int n = sc.nextInt();
		xx = new int[n * 2]; aa = new int[n * 2];
		ll = new int[n]; rr = new int[n];
		cc = new int[n];
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int c = sc.nextInt();
			int l = Math.min(x, y);
			int r = Math.max(x, y);
			xx[ll[i] = i << 1] = l;
			xx[rr[i] = i << 1 | 1] = r;
			cc[i] = c;
		}
		Integer[] ii = new Integer[n * 2];
		for (int i = 0; i < n * 2; i++)
			ii[i] = i;
		Arrays.sort(ii, 0, n * 2, (i, j) -> xx[i] - xx[j]);
		int a = 0;
		for (int i = 0; i < n * 2; i++)
			aa[ii[i]] = i + 1 == n * 2 || xx[ii[i + 1]] != xx[ii[i]] ? a++ : a;
		for (int i = 0; i < n; i++)
			ii[i] = i;
		Arrays.sort(ii, 0, n, (i, j) -> aa[rr[i]] - aa[rr[j]]);
		build(n, a);
		long c_ = 0, xl_ = INF, xr_ = INF;
		for (int i = 0, j; i < n; i = j) {
			int r = rr[ii[i]], ar = aa[r], xr = xx[r];
			j = i + 1;
			while (j < n && aa[rr[ii[j]]] == ar)
				j++;
			for (int h = i; h < j; h++) {
				int al = aa[ll[ii[h]]];
				update(0, al, cc[ii[h]]);
			}
			long c = query(0, ar) - xr;
			if (c_ < c) {
				c_ = c; xl_ = xx[i_]; xr_ = xr;
			}
		}
		println(c_);
		println(xl_ + " " + xl_ + " " + xr_ + " " + xr_);
	}
}