#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 1000000 + 10, inf = (1ll << 60);
int u[Maxn], v[Maxn], q[Maxn], n;
long long a[Maxn], f[Maxn], ans;
struct node {
  int u, v;
  long long c;
} g[Maxn];
inline bool cmp(node x, node y) {
  if (x.u == y.u) return x.v < y.v;
  return x.u < y.u;
}
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
inline long double slope(int x, int y) {
  if (u[x] == u[y]) return 1.0 * inf;
  return 1.0 * (f[x] - f[y]) / (u[x] - u[y]);
}
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i)
    g[i].u = read(), g[i].v = read(), g[i].c = read();
  sort(g + 1, g + 1 + n, cmp);
  for (register int i = 1; i <= n; ++i) {
    u[i] = g[i].u;
    v[i] = g[i].v;
    a[i] = g[i].c;
  }
  int l = 1, r = 1;
  for (register int i = 1; i <= n; ++i) {
    while (l < r && slope(q[l], q[l + 1]) >= v[i]) ++l;
    int j = q[l];
    f[i] = f[j] + (long long)(u[i] - u[j]) * v[i] - a[i];
    ans = max(ans, f[i]);
    while (l < r && slope(q[r - 1], q[r]) <= slope(q[r], i)) --r;
    q[++r] = i;
  }
  printf("%lld\n", ans);
  return 0;
}
