#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const double eps = 1e-9;
int n, q[N], l, r;
long long f[N], ans;
struct node {
  int x, y;
  long long a;
} s[N];
bool cmp(const node p, const node q) { return p.x < q.x; }
double slope(const int i, const int j) {
  if (s[j].x - s[i].x <= eps) return 1e10;
  return 1.0 * (f[j] - f[i]) / (s[j].x - s[i].x);
}
long long read() {
  long long x = 0;
  int f = 1;
  char s;
  while ((s = getchar()) > '9' || s < '0')
    if (s == '-') f = -1;
  while (s >= '0' && s <= '9')
    x = (x << 1) + (x << 3) + (s ^ 48), s = getchar();
  return x * f;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i)
    s[i].x = read(), s[i].y = read(), s[i].a = read();
  sort(s + 1, s + n + 1, cmp);
  for (int i = 1; i <= n; ++i) {
    while (l < r && slope(q[l], q[l + 1]) >= s[i].y) ++l;
    if (l <= r) f[i] = f[q[l]] + 1ll * (s[i].x - s[q[l]].x) * s[i].y - s[i].a;
    while (l < r && slope(q[r - 1], q[r]) <= slope(q[r], i)) --r;
    q[++r] = i;
    ans = max(ans, f[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
