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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author beginner1010
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskF {
        HashMap<Integer, Integer> map;
        int[] revMap;
        ArrayList<pair>[] event;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[][] points = new int[n][3];

            TreeSet<Integer> set = new TreeSet<>();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 3; j++) {
                    points[i][j] = in.nextInt();
                    if (j < 2)
                        set.add(points[i][j]);
                }
            }
            set.add(set.last() + 1); // to avoid all negative numbers
            int m = set.size();

            map = new HashMap<>();
            revMap = new int[m];


            int pointIdx = 0;
            for (int coord : set) {
                map.put(coord, pointIdx);
                revMap[pointIdx++] = coord;
            }

            event = new ArrayList[m];
            for (int i = 0; i < m; i++) {
                event[i] = new ArrayList<>();
            }

            for (int i = 0; i < n; i++) {
                int mn = map.get(Math.min(points[i][0], points[i][1]));
                int mx = map.get(Math.max(points[i][0], points[i][1]));
                event[mn].add(new pair(mx, points[i][2]));
            }

            segmentTree tree = new segmentTree(m);
            long bestScore = -1;
            long L = -1, R = -1;
            for (int i = m - 1; i >= 0; i--) {
                for (pair p : event[i]) {
                    tree.inc(p.coord, m, p.val);
                }
                cell best = tree.query(i, m);
                if (best.val + revMap[i] > bestScore) {
                    bestScore = best.val + revMap[i];
                    L = revMap[i];
                    R = revMap[best.idx];
                }
            }
            out.println(bestScore + "\n" + L + " " + L + " " + R + " " + R);
        }

        class cell {
            int idx;
            long val;

            cell(long _val, int _idx) {
                this.val = _val;
                this.idx = _idx;
            }

        }

        class segmentTree {
            final long INF = 1L << 59;
            int log;
            int n;
            cell[] seg;
            long[] lazy;

            segmentTree(int _n) {
                this.log = 0;
                while ((1 << this.log) < _n) this.log++;
                this.n = _n;
                seg = new cell[n << 1];
                this.lazy = new long[n];
                for (int i = 0; i < seg.length; i++) {
                    if (i < this.n) seg[i] = new cell(-INF, -1);
                    else {
                        seg[i] = new cell(-revMap[i - this.n], i - this.n);
                    }
                }
            }

            void build(int p) {
                while (p > 1) {
                    p >>= 1;
                    this.seg[p].val = this.seg[p * 2].val;
                    this.seg[p].idx = this.seg[p * 2].idx;
                    if (this.seg[p].val < this.seg[p * 2 + 1].val) {
                        this.seg[p].val = this.seg[p * 2 + 1].val;
                        this.seg[p].idx = this.seg[p * 2 + 1].idx;
                    }
                    this.seg[p].val += this.lazy[p];
                }
            }

            void apply(int node, long val) {
                this.seg[node].val += val;
                if (node < this.n) this.lazy[node] += val;
            }

            void push(int p) {
                for (int i = this.log; i > 0; i--) {
                    int node = p >> i;
                    if (lazy[node] != 0) {
                        apply(node << 1, lazy[node]);
                        apply(node << 1 | 1, lazy[node]);
                        lazy[node] = 0;
                    }
                }
            }

            void inc(int l, int r, long val) {
                l += this.n;
                r += this.n;
                int l0 = l, r0 = r;
                for (; l < r; l >>= 1, r >>= 1) {
                    if ((l & 1) == 1) this.apply(l++, val);
                    if ((r & 1) == 1) this.apply(--r, val);
                }
                build(l0);
                build(r0 - 1);
            }

            cell query(int l, int r) {
                l += this.n;
                r += this.n;
                push(l);
                push(r - 1);
                cell best = new cell(-INF, -1);
                for (; l < r; l >>= 1, r >>= 1) {
                    if ((l & 1) == 1) {
                        if (this.seg[l].val > best.val) {
                            best.val = this.seg[l].val;
                            best.idx = this.seg[l].idx;
                        }
                        l++;
                    }
                    if ((r & 1) == 1) {
                        --r;
                        if (this.seg[r].val > best.val) {
                            best.val = this.seg[r].val;
                            best.idx = this.seg[r].idx;
                        }
                    }
                }
                return best;
            }

        }

        class pair {
            int coord;
            int val;

            pair(int _coord, int _val) {
                this.coord = _coord;
                this.val = _val;
            }

        }

    }

    static class InputReader {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputStream stream;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }

    }
}