#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 5;
long long n, X[maxn], Y[maxn], stk[maxn], top, ans, f[maxn];
struct node {
  long long x, y, a;
  bool operator<(const node &b) const { return x < b.x; }
} a[maxn];
long double xl(long long x, long long y) {
  return (long double)(Y[y] - Y[x]) / ((long double)(X[y] - X[x]));
}
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++)
    scanf("%lld%lld%lld", &a[i].x, &a[i].y, &a[i].a);
  sort(a + 1, a + 1 + n);
  long long hd = 0, tl = 0;
  for (long long i = 1; i <= n; i++) {
    while (hd < tl && xl(stk[hd], stk[hd + 1]) > a[i].y) hd++;
    f[i] = (f[stk[hd]] - a[stk[hd]].x * a[i].y) + a[i].x * a[i].y - a[i].a;
    X[i] = a[i].x, Y[i] = f[i];
    while (hd < tl && xl(stk[tl - 1], stk[tl]) <= xl(stk[tl], i)) tl--;
    stk[++tl] = i;
    ans = max(ans, f[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
