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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    private class Rect implements Comparable {
        public long x;
        public long y;
        public long cost;

        @Override
        public int compareTo(Object o) {
            return Long.compare(x, ((Rect) o).x);
        }
    }

    private class Pair<A, B> {
        public A x;
        public B y;

        public Pair(A a, B b) {
            x = a;
            y = b;
        }

        public Pair(Pair<A, B> p) {
            x = p.x;
            y = p.y;
        }
    }

    private class Line {
        long a, b;

        public Line(long i, long i1) {
            a = i;
            b = i1;
        }

        long eval(long c) {
            return a * c + b;
        }

        double intersectX(Line l) {
            return (double) (b - l.b) / (l.a - a);
        }
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    private void solve(FastReader cin) {
        int n = cin.nextInt();
        Rect[] r = new Rect[n];
        for (int i = 0; i < n; i++) {
            r[i] = new Rect();
            r[i].x = cin.nextLong();
            r[i].y = cin.nextLong();
            r[i].cost = cin.nextLong();
        }
        Arrays.sort(r);
        ArrayList<Line> dq = new ArrayList<>();
        dq.add(new Line(0, 0));
        long ans = 0;
        for (int i = 0; i < n; i++) {
            while (dq.size() >= 2 && dq.get(dq.size() - 1).eval(r[i].y) <= dq.get(dq.size() - 2).eval((r[i].y)))
                dq.remove(dq.size() - 1);
            long f = dq.get(dq.size() - 1).eval(r[i].y) + r[i].x * r[i].y - r[i].cost;
            ans = Math.max(ans, f);
            Line cur = new Line(-r[i].x, f);
            while (dq.size() >= 2 && cur.intersectX(dq.get(0)) >= dq.get(0).intersectX(dq.get(1)))
                dq.remove(0);
            dq.add(0, cur);
        }
        System.out.println(ans);
    }

    public static void main(String[] args) {
        Main main = new Main();
        main.solve(new FastReader());
    }
}
