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>
import java.util.*;
import java.io.*;
public class Main{
    static PrintWriter out;
    static InputReader in;
    public static void main(String args[]){
        out = new PrintWriter(System.out);
        in = new InputReader();
        new Main();
        out.flush(); out.close();
    }   
    Main(){
        solve();
    }
    class pair{
        int F, S, T;
        pair(int a, int b, int c){
            F = a; S = b; T = c;
        }
    }
    class qu{
        long F; int S;
        qu(long a, int b){
            F = a; S = b;
        }
    }
    final int max = 1000100;
    final long maxv = -(long)1e18;
    int n;
    long V[] = new long[4 * max];
    int I[] = new int[4 * max];
    long lazy[] = new long[4 * max];
    ArrayList<pair> al = new ArrayList<>();
    TreeSet<Integer> ts = new TreeSet<>();
    HashMap<Integer, Integer> hash = new HashMap<>();
    int rhash[] = new int[max];
    void upd(int n, int s, int e, int id, long val){
        if(id < s || id > e)return;
        if(s == e){
            V[n] = val; I[n] = id;
            return; 
        }
        int m = (s + e) >> 1;
        upd(2 * n + 1, s, m, id, val); upd(2 * n + 2, m + 1, e, id, val);
        if(V[2 * n + 1] >= V[2 * n + 2]){
            V[n] = V[2 * n + 1];
            I[n] = I[2 * n + 1];
        }else{
            V[n] = V[2 * n + 2];
            I[n] = I[2 * n + 2];
        }
    }
    void lazyupd(int n, int s, int e){
        V[n] += lazy[n];
        if(s != e){
            lazy[2 * n + 1] += lazy[n];
            lazy[2 * n + 2] += lazy[n];
        }
        lazy[n] = 0;
    }
    void upd(int n, int s, int e, int l, int r, long val){
        lazyupd(n, s, e);
        if(l > e || r < s)return;
        if(s >= l && e <= r){
            lazy[n] += val;
            lazyupd(n, s, e);
            return;
        }
        int m = (s + e) >> 1;
        upd(2 * n + 1, s, m, l, r, val);
        upd(2 * n + 2, m + 1, e, l, r, val);
        if(V[2 * n + 1] >= V[2 * n + 2]){
            V[n] = V[2 * n + 1];
            I[n] = I[2 * n + 1];
        }else{
            V[n] = V[2 * n + 2];
            I[n] = I[2 * n + 2];
        }   
    }
    qu query(int n, int s, int e, int l, int r){
        lazyupd(n, s, e);
        if(l > e || r < s)return new qu(maxv, -1);
        if(s >= l && e <= r){
            return new qu(V[n], I[n]);
        }
        int m = (s + e) >> 1;
        qu q1 = query(2 * n + 1, s, m, l, r);
        qu q2 = query(2 * n + 2, m + 1, e, l, r);
        if(q1.F >= q2.F){
            return q1;
        }return q2;
    }
    void solve(){
        n = in.nextInt();
        for(int i = 0; i < n; i++){
            int x = in.nextInt(), y = in.nextInt(), c = in.nextInt();
            if(x > y){
                x ^= y;
                y ^= x;
                x ^= y;
            }
            ts.add(x); ts.add(y); al.add(new pair(x, y, c));
        }
        int ptr = 0;
        for(Iterator it = ts.iterator(); it.hasNext();){
            int v = (int)it.next();
            hash.put(v, ++ptr);
            rhash[ptr] = v;
        }
        ts.clear();
        for(int i = 0; i < n; i++){
            pair p = al.get(i);
            p.F = hash.get(p.F); p.S = hash.get(p.S);
        }
        hash.clear(); 
        Collections.sort(al, (A, B) -> A.S - B.S);
        long ps = 0;
        Arrays.fill(V, maxv);
        for(int i = 0; i < n;){
            pair p = al.get(i);
            for(int j = i; j < n;){
                pair p1 = al.get(j);
                if(p1.S == p.S){
                    ps += p1.T; i++; j++;
                }else{
                    break;
                }
            }
            upd(0, 0, max - 1, p.S, ps - rhash[p.S]);
        }
        Collections.sort(al, (A, B) -> A.F - B.F);
        final int ml = (int)2e9;
        long ans = 0, x1 = ml, x2 = ml;
        for(int i = 0; i < n;){
            pair p = al.get(i);
            qu q = query(0, 0, max - 1, p.F, max - 1);
            long val = q.F + rhash[p.F];
            // System.out.println(p.F + " " + val + " " + q.S);
            if(val > ans){
                ans = val; 
                x1 = rhash[p.F]; x2 = rhash[q.S];
            }
            for(int j = i; j < n;){
                pair p1 = al.get(j);
                if(p1.F == p.F){
                    upd(0, 0, max - 1, p1.S, max - 1, -p1.T);
                    j++; i++;
                }else{
                    break;
                }
            }
        }
        out.println(ans);
        out.print(x1 + " " + x1 + " " + x2 + " " + x2);
    }
    public static class InputReader{
        BufferedReader br;
        StringTokenizer st;
        InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
        public String next(){
            while(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){}
            }
            return st.nextToken();
        }
    }
}
        