#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1100000;
struct Rect {
  int x, y;
  long long v;
  bool operator<(const Rect& rhs) const { return x < rhs.x; }
} a[MAXN];
int q[MAXN];
long long f[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d%lld", &a[i].x, &a[i].y, &a[i].v);
  sort(a + 1, a + n + 1);
  int op = 0, cl = 0;
  q[cl++] = 0;
  for (int i = 1; i <= n; i++) {
    while (cl - op >= 2 &&
           1.0 * (f[q[op + 1]] - f[q[op]]) / (a[q[op + 1]].x - a[q[op]].x) >=
               a[i].y)
      op++;
    f[i] = f[q[op]] + 1ll * (a[i].x - a[q[op]].x) * a[i].y - a[i].v;
    while (cl - op >= 2 &&
           1.0 * (f[i] - f[q[cl - 1]]) / (a[i].x - a[q[cl - 1]].x) >=
               1.0 * (f[q[cl - 1]] - f[q[cl - 2]]) /
                   (a[q[cl - 1]].x - a[q[cl - 2]].x))
      cl--;
    q[cl++] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, f[i]);
  printf("%lld\n", ans);
  return 0;
}
