#include <bits/stdc++.h>
using namespace std;
const long long M = 1000005;
long long read() {
  long long x = 0, f = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9') {
    if (c == '-') f = -1;
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long n, h, t, ans, q[M], f[M];
struct node {
  long long x, y, z;
  bool operator<(const node &b) const { return x < b.x; }
} a[M];
double slope(long long x, long long y) {
  return 1.0 * (f[x] - f[y]) / (a[x].x - a[y].x);
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) {
    a[i].x = read();
    a[i].y = read();
    a[i].z = read();
  }
  sort(a + 1, a + 1 + n);
  for (long long i = 1; i <= n; i++) {
    while (h < t && slope(q[h], q[h + 1]) > a[i].y) h++;
    f[i] = f[q[h]] + (a[i].x - a[q[h]].x) * a[i].y - a[i].z;
    ans = max(ans, f[i]);
    while (h < t && slope(q[t], q[t - 1]) < slope(i, q[t])) t--;
    q[++t] = i;
  }
  printf("%lld\n", ans);
}
