#include <bits/stdc++.h>
using namespace std;
bool Q;
struct Line {
  mutable long long k, m, p;
  bool operator<(const Line& o) const { return Q ? p < o.p : k < o.k; }
};
struct LineContainer : multiset<Line> {
  const long long inf = LLONG_MAX;
  long long div(long long a, long long b) {
    return a / b - ((a ^ b) < 0 && a % b);
  }
  bool isect(iterator x, iterator y) {
    if (y == end()) {
      x->p = inf;
      return false;
    }
    if (x->k == y->k)
      x->p = x->m > y->m ? inf : -inf;
    else
      x->p = div(y->m - x->m, x->k - y->k);
    return x->p >= y->p;
  }
  void add(long long k, long long m) {
    auto z = insert({k, m, 0}), y = z++, x = y;
    while (isect(y, z)) z = erase(z);
    if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
    while ((y = x) != begin() && (--x)->p >= y->p) isect(x, erase(y));
  }
  long long query(long long x) {
    if (empty()) return 0;
    Q = 1;
    auto l = *lower_bound({0, 0, x});
    Q = 0;
    if (l.k * 1.0 * x + l.m >= 4e18) return 4e18;
    return l.k * x + l.m;
  }
} dp;
long long x[1000005], y[1000005], a[1000005];
pair<pair<long long, long long>, int> p[1000005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &x[i], &y[i], &a[i]);
    p[i] = make_pair(make_pair(x[i], -y[i]), i);
  }
  sort(p + 1, p + 1 + n);
  dp.add(0, 0);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int j = p[i].second;
    long long res = x[j] * 1ll * y[j] + dp.query(y[j]) - a[j];
    dp.add(-x[j], res);
    ans = max(ans, res);
  }
  printf("%lld\n", ans);
}
