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