#include <bits/stdc++.h>
using namespace std;
struct Line {
  long long M, P;
  Line(long long m = 0, long long p = 0) {
    M = m;
    P = p;
  }
};
struct Node {
  long long l, r;
  Node *lft, *rgt;
  Line L;
  Node(long long l1, long long r1) : L(0, 0) {
    l = l1;
    r = r1;
    lft = 0;
    rgt = 0;
  }
};
long long n;
pair<pair<long long, long long>, long long> a[1000010];
long long dp[1000010];
long long ans = 0;
Node* seg;
long long fun(Line L, long long x) { return L.M * x + L.P; }
void update(Line val, Node* nod = seg) {
  long long l = nod->l, r = nod->r;
  Line old = nod->L;
  long long mid = (l + r) / 2;
  long long lf = fun(val, l) - fun(old, l);
  long long rg = fun(val, r) - fun(old, r);
  long long md = fun(val, mid) - fun(old, mid);
  long long d;
  if (lf >= 0 && rg >= 0) {
    nod->L = val;
    return;
  }
  if (lf <= 0 && rg <= 0) {
    return;
  }
  if (md >= 0) {
    nod->L = val;
    if (lf > 0)
      d = 2;
    else
      d = 1;
  } else {
    swap(val, old);
    if (lf > 0)
      d = 1;
    else
      d = 2;
  }
  if (d == 1) {
    if (nod->lft == 0) nod->lft = new Node(l, mid);
    update(old, nod->lft);
  } else {
    if (nod->rgt == 0) nod->rgt = new Node(mid + 1, r);
    update(old, nod->rgt);
  }
}
void add(long long m, long long p) {
  Line x(m, p);
  update(x);
}
long long query(long long x, Node* nod = seg) {
  long long l = nod->l, r = nod->r;
  Line old = nod->L;
  long long mid = (l + r) / 2;
  long long res = fun(old, x);
  if (x <= mid) {
    if (nod->lft == 0) {
      return max(res, 0ll);
    }
    return max(res, query(x, nod->lft));
  } else {
    if (nod->rgt == 0) {
      return max(res, 0ll);
    }
    return max(res, query(x, nod->rgt));
  }
}
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    long long f, g, h;
    scanf("%lld %lld %lld", &f, &g, &h);
    a[i].first.first = f;
    a[i].first.second = g;
    a[i].second = h;
  }
  sort(a, a + n);
  seg = new Node(0, 1e9 + 10);
  add(0, 0);
  for (int idx = 0; idx < n; idx++) {
    dp[idx] = a[idx].first.first * a[idx].first.second - a[idx].second;
    long long z = query(a[idx].first.second);
    dp[idx] += z;
    ans = max(ans, dp[idx]);
    add(-a[idx].first.first, dp[idx]);
  }
  printf("%lld\n", ans);
  return 0;
}
