#include <bits/stdc++.h>
using namespace std;
const int mod1 = 998244353, mod = 1e9 + 7;
const int MAXN = 1e6 + 6, MAXM = 200010;
struct _line {
  long long a;
  long long b;
  _line(long long a = 0, long long b = 0) : a(a), b(b) {}
  long long f(long long x) { return 1LL * a * x + b; };
};
struct _rect {
  long long w, h;
  long long f;
  bool operator<(const _rect& rc) const { return w < rc.w; }
} a[MAXN];
double slp(_line ln1, _line ln2) {
  return (double)(ln2.b - ln1.b) / (double)(ln2.a - ln1.a);
}
bool cmp(_line l, _line a, _line b) { return slp(l, a) <= slp(l, b); }
struct Convex_Hull {
  vector<_line> lines;
  long long pt = 0;
  void add(long long a, long long b) {
    _line ln(a, b);
    while ((long long)lines.size() > 1 &&
           cmp(lines[(long long)lines.size() - 2], lines.back(), ln))
      lines.pop_back();
    lines.push_back(ln);
    pt = min(pt, (long long)lines.size() - 1);
  }
  long long get(long long x) {
    if (lines.empty()) return -1e18;
    while (pt + 1 < (long long)lines.size() &&
           lines[pt].f(x) < lines[pt + 1].f(x))
      pt++;
    return lines[pt].f(x);
  }
} CHT;
long long n, ans = 0;
void Solve() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i].w >> a[i].h >> a[i].f;
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; ++i) {
    long long tmp = max(0LL, CHT.get(-a[i].h)) + 1LL * a[i].w * a[i].h - a[i].f;
    ans = max(ans, tmp);
    CHT.add(a[i].w, tmp);
  }
  cout << ans;
}
signed main() {
  if (fopen(""
            ".inp",
            "r")) {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  };
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long TC = 1;
  while (TC--) Solve();
  return 0;
}
