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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
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);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            Rectangle[] rect = new Rectangle[n];
            for (int i = 0; i < n; i++) {
                long x = in.nextLong();
                long y = in.nextLong();
                long a = in.nextLong();
                rect[i] = new Rectangle(x, y, a);
            }
            Arrays.sort(rect);

            long[] dp = new long[n];
            Line[] dq = new Line[n];

            int fptr = n;
            int bptr = n;

            long ans = 0;
            for (int i = 0; i < n; i++) {
                while (bptr - fptr >= 2 && dq[bptr - 1].evaluation(rect[i].y) < dq[bptr - 2].evaluation(rect[i].y)) {
                    bptr--;
                }
                assert (bptr >= fptr);
                dp[i] = rect[i].x * rect[i].y - rect[i].a + (bptr == fptr ? 0 : Math.max(0, dq[bptr - 1].evaluation(rect[i].y)));
                Line curLine = new Line(-rect[i].x, dp[i]);
                while (bptr - fptr >= 2 && dq[fptr].intersect(curLine) >= dq[fptr].intersect(dq[fptr + 1])) {
                    fptr++;
                }
                dq[--fptr] = new Line(-rect[i].x, dp[i]);
                ans = Math.max(ans, dp[i]);
            }
            out.println(ans);
        }

        class Rectangle implements Comparable<Rectangle> {
            long x;
            long y;
            long a;

            Rectangle(long x, long y, long a) {
                this.x = x;
                this.y = y;
                this.a = a;
            }


            public int compareTo(Rectangle o) {
                if (o.x != this.x) return this.x < o.x ? -1 : 1;
                if (o.y != this.y) return this.y < o.y ? -1 : 1;
                if (o.a != this.a) return this.a < o.a ? -1 : 1;
                return 0;
            }

        }

        class Line {
            long c;
            long slope;

            Line(long slope, long c) {
                this.slope = slope;
                this.c = c;
            }

            double intersect(Line o) {
                return ((double) (o.c - this.c)) / ((double) this.slope - o.slope);
            }

            long evaluation(long x) {
                return x * this.slope + c;
            }

        }

    }

    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;
        }

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

    }
}

