The Fair Nut got stacked in planar world. He should solve this task to get out.

You are given n rectangles with vertexes in (0, 0), (x_i, 0), (x_i, y_i), (0, y_i). For each rectangle, you are also given a number a_i. Choose some of them that the area of union minus sum of a_i of the chosen ones is maximum.

It is guaranteed that there are no nested rectangles.

Nut has no idea how to find the answer, so he asked for your help.

Input

The first line contains one integer n (1 ≤ n ≤ 10^6) — the number of rectangles.

Each of the next n lines contains three integers x_i, y_i and a_i (1 ≤ x_i, y_i ≤ 10^9, 0 ≤ a_i ≤ x_i ⋅ y_i).

It is guaranteed that there are no nested rectangles.

Output

In a single line print the answer to the problem — the maximum value which you can achieve.

Examples

Input


3
4 4 8
1 5 0
5 2 10


Output


9

Input


4
6 2 4
1 6 2
2 4 3
5 3 8


Output


10

Note

In the first example, the right answer can be achieved by choosing the first and the second rectangles.

In the second example, the right answer can also be achieved by choosing the first and the second rectangles.
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        //Scanner sc = new Scanner();
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();
 
    }
 
    static int INF = (int)1e9;
    static int maxn = (int)1e6+100;
    static int mod= 998244353 ;
    static int n,m,k,t,q,d,cnt=2;
    static long[] xs,ys,a;
    static Line[] line;
    
    void solve(PrintWriter out, Reader in) throws IOException{
        n = in.nextInt();
        
        line = new Line[maxn*4];
        line[1] = new Line(0,0);
        
        xs = new long[n];
        ys = new long[n];
        a = new long[n];
        Integer[] indices = new Integer[n];
		for (int i = 0; i < n; i++) {
			indices[i] = i;
			xs[i] = in.nextLong();
			ys[i] = in.nextLong();
			a[i] = in.nextLong();
		}
		Arrays.sort(indices, Comparator.comparingLong(i -> xs[i]));
        
        long ans =0;
        for(int i=0;i<n;i++){
            long temp = query(1,1,INF,ys[indices[i]])+xs[indices[i]]*ys[indices[i]]-a[indices[i]];            
            ans = Math.max(ans,temp);
            add_line(1,1,INF,new Line(-xs[indices[i]],temp));
        }
        out.println(ans);
        
    }
    
    
    static void add_line(int idx,int s,int e,Line nw){
        int mid = (s+e)/2;
        
        boolean s_nw   = nw.eval(s)   > line[idx].eval(s);
        boolean mid_nw = nw.eval(mid) > line[idx].eval(mid);
        
        if(mid_nw) {
            Line tmp = new Line(nw.m,nw.c);
            nw = new Line(line[idx].m,line[idx].c);
            line[idx].m = tmp.m;
            line[idx].c = tmp.c;
        }
        
        if(s==e) return;
        if(s_nw!=mid_nw){
            if(line[idx].l==0){
                line[idx].l=cnt++;
                line[cnt-1] = nw;
                return;
            }
            add_line(line[idx].l,s,mid,nw);
        }else{
            if(line[idx].r==0){
                line[idx].r=cnt++;
                line[cnt-1] = nw;
                return;
            }
            add_line(line[idx].r,mid+1,e,nw);
        }
    }
    
    static long query(int idx,int s,int e,long x){
        long res=line[idx].eval(x);
        
        if(s==e) return res;
        
        int mid=(s+e)/2;
        if(x<=mid){
            if(line[idx].l==0) return res;
            return Math.max(res,query(line[idx].l,s,mid,x));
        }else {
            if(line[idx].r==0) return res;
            return Math.max(res,query(line[idx].r,mid+1,e,x));
        }
    }
    
    static class Line{
        long m,c;
        int l=0,r=0;
        
        Line(long m,long c){
            this.m = m;
            this.c = c;
        }
        
        double inter(Line l){
            return (double)(l.c-c)/(double)(m-l.m);
        }
        
        long eval(long x){
            return m*x+c;
        }
    }
    
    static class Reader {

    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public Reader() {
        this(System.in);
    }

    public Reader(InputStream is) {
        mIs = is;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();

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

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

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

    public int nextInt() {
        int c = read();
        while (isSpaceChar(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 (!isSpaceChar(c));
        return res * sgn;
    }

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

    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    }
}