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.
#include <bits/stdc++.h>
using namespace std;
struct cht {
  struct Line {
    int a;
    long long b, val;
    double xLeft;
    bool type;
    Line(long long _a = 0, long long _b = 0) {
      a = _a;
      b = _b;
      xLeft = -1e16;
      type = 0;
      val = 0;
    }
    long long valueAt(int x) const { return a * 1ll * x + b; }
    friend bool areParallel(const Line &l1, const Line &l2) {
      return l1.a == l2.a;
    }
    friend double intersectX(const Line &l1, const Line &l2) {
      return areParallel(l1, l2) ? 1e16 : 1.0 * (l2.b - l1.b) / (l1.a - l2.a);
    }
    bool operator<(const Line &l2) const {
      if (!l2.type) return a < l2.a;
      return xLeft > l2.val;
    }
  };
  set<Line> hull;
  bool hasPrev(set<Line>::iterator it) { return it != hull.begin(); }
  bool hasNext(set<Line>::iterator it) {
    return it != hull.end() && next(it) != hull.end();
  }
  bool irrelevant(const Line &l1, const Line &l2, const Line &l3) {
    return intersectX(l1, l3) <= intersectX(l1, l2);
  }
  bool irrelevant(set<Line>::iterator it) {
    return hasPrev(it) && hasNext(it) &&
           (irrelevant(*next(it), *it, *prev(it)));
  }
  set<Line>::iterator updateLeftBorder(set<Line>::iterator it) {
    if (!hasNext(it)) return it;
    double val = intersectX(*it, *next(it));
    Line buf(*it);
    it = hull.erase(it);
    buf.xLeft = val;
    it = hull.insert(it, buf);
    return it;
  }
  void addLine(int a, long long b) {
    Line l3 = Line(a, b);
    auto it = hull.lower_bound(l3);
    if (it != hull.end() && areParallel(*it, l3)) {
      if (it->b > b)
        it = hull.erase(it);
      else
        return;
    }
    it = hull.insert(it, l3);
    if (irrelevant(it)) {
      hull.erase(it);
      return;
    }
    while (hasPrev(it) && irrelevant(prev(it))) hull.erase(prev(it));
    while (hasNext(it) && irrelevant(next(it))) hull.erase(next(it));
    it = updateLeftBorder(it);
    if (hasPrev(it)) updateLeftBorder(prev(it));
    if (hasNext(it)) updateLeftBorder(next(it));
  }
  long long getBest(int x) {
    Line q;
    q.val = x;
    q.type = 1;
    auto bestLine = hull.lower_bound(q);
    if (bestLine == hull.end()) return 1e16;
    return bestLine->valueAt(x);
  }
};
const int N = 1e6;
struct Rect {
  int x, y;
  long long a;
  bool operator<(const Rect &other) const { return x < other.x; }
} pts[N];
long long best[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> pts[i].x >> pts[i].y >> pts[i].a;
  }
  sort(pts, pts + n);
  cht hull;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long val = hull.getBest(pts[i].y);
    best[i] = pts[i].x * 1ll * pts[i].y - pts[i].a - min(0ll, val);
    ans = max(ans, best[i]);
    hull.addLine(pts[i].x, -best[i]);
  }
  cout << ans << endl;
  return 0;
}
