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:
import java.io.*;
import java.nio.CharBuffer;
import java.util.*;

public class P1221F {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        HashSet<Integer> coordinateSet = new HashSet<>(2 * n);
        ArrayList<Segment> segments = new ArrayList<>(n);
        for (int i = 0; i < n; ++i) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            int w = scanner.nextInt();
            coordinateSet.add(x);
            coordinateSet.add(y);
            segments.add(new Segment(Math.min(x, y), Math.max(x, y), w));
        }
        ArrayList<Integer> coordinates = new ArrayList<>(coordinateSet);
        coordinates.sort(Comparator.naturalOrder());
        int m = coordinates.size();
//        HashMap<Integer, Integer> coordinateMap = new HashMap<>(m);
//        for (int i = 0; i < m; ++i)
//            coordinateMap.put(coordinates.get(i), i);
        SegmentTree segmentTree = new SegmentTree(coordinates);
        long ans = 0;
        int ansL, ansR;
        ansL = ansR = coordinates.get(m - 1) + 1;
        segments.sort(Comparator.comparingInt(o -> o.x));
        for (int l = m - 1, i = n - 1; l >= 0 && i >= 0; --l) {
            if (segments.get(i).x >= coordinates.get(l)) {
                while (i >= 0 && segments.get(i).x >= coordinates.get(l)) {
                    segmentTree.add(Collections.binarySearch(coordinates, segments.get(i).y), m - 1, segments.get(i).w);
                    --i;
                }
                long[] max = segmentTree.getMax(l, m - 1);
                if (max[0] + coordinates.get(l) > ans) {
                    ans = max[0] + coordinates.get(l);
                    ansL = coordinates.get(l);
                    ansR = coordinates.get((int) max[1]);
                }
            }
        }
        writer.println(ans);
        writer.println(ansL + " " + ansL + " " + ansR + " " + ansR);

        writer.close();
    }

    private static class Segment {
        private final int x, y, w;

        private Segment(int x, int y, int w) {
            this.x = x;
            this.y = y;
            this.w = w;
        }
    }

    private static class SegmentTree {

        private long[] max;
        private int[] idx;
        private long[] add;
        private int n;

        private SegmentTree(List<Integer> coordinateList) {
            n = coordinateList.size() - 1;
            max = new long[4 * n + 1];
            idx = new int[4 * n + 1];
            add = new long[4 * n + 1];
            build(0, 0, n, coordinateList);
        }

        private void build(int k, int l0, int r0, List<Integer> coordinateList) {
            if (l0 == r0) {
                max[k] = -coordinateList.get(l0);
                idx[k] = l0;
                return;
            }
            int mid = (l0 + r0) / 2;
            build(2 * k + 1, l0, mid, coordinateList);
            build(2 * k + 2, mid + 1, r0, coordinateList);
            update(k);
        }

        private void update(int k) {
            if (max[2 * k + 1] >= max[2 * k + 2]) {
                max[k] = max[2 * k + 1];
                idx[k] = idx[2 * k + 1];
            } else {
                max[k] = max[2 * k + 2];
                idx[k] = idx[2 * k + 2];
            }
        }

        private void push(int k) {
            max[2 * k + 1] += add[k];
            max[2 * k + 2] += add[k];
            add[2 * k + 1] += add[k];
            add[2 * k + 2] += add[k];
            add[k] = 0;
        }

        private void add(int l, int r, int v) {
            add(0, 0, n, l, r, v);
        }

        private void add(int k, int l0, int r0, int l, int r, int v) {
            if (l > r)
                return;
            if (l == l0 && r == r0) {
                max[k] += v;
                add[k] += v;
                return;
            }
            push(k);
            int mid = (l0 + r0) / 2;
            add(2 * k + 1, l0, mid, l, Math.min(mid, r), v);
            add(2 * k + 2, mid + 1, r0, Math.max(mid + 1, l), r, v);
            update(k);
        }

        private long[] getMax(int l, int r) {
            return getMax(0, 0, n, l, r);
        }

        private long[] getMax(int k, int l0, int r0, int l, int r) {
            if (l > r)
                return new long[]{Long.MIN_VALUE, -1};
            if (l <= l0 && r0 <= r)
                return new long[]{max[k], idx[k]};
            push(k);
            int mid = (l0 + r0) / 2;
            long[] lResult = getMax(2 * k + 1, l0, mid, l, Math.min(mid, r));
            long[] rResult = getMax(2 * k + 2, mid + 1, r0, Math.max(mid + 1, l), r);
            if (lResult[0] >= rResult[0])
                return lResult;
            else
                return rResult;
        }
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        private SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}