#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c = getchar();
  long long x = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + (c - '0'), c = getchar();
  return x;
}
void MOD(int &x) {
  if (x >= 998244353) x -= 998244353;
}
struct node {
  long long x, y, v;
} e[1000010];
bool cmp(node a, node b) { return a.x < b.x; }
int q[1000010];
long long a[1000010], b[1000010], c[1000010], d[1000010];
long long f[1000010];
int main() {
  int n;
  n = read();
  for (int i = 1; i <= n; i++)
    e[i].x = read(), e[i].y = read(), e[i].v = read();
  sort(e + 1, e + n + 1, cmp);
  int l = 1, r = 0;
  q[r++] = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    a[i] = -e[i].y;
    c[i] = -e[i].v + e[i].x * e[i].y;
    while (l < r && (double)(d[q[l + 1]] - d[q[l]]) / (b[q[l + 1]] - b[q[l]]) >=
                        -(double)a[i])
      l++;
    int j = q[l];
    f[i] = a[i] * b[j] + c[i] + d[j];
    b[i] = e[i].x;
    d[i] = f[i];
    while (l < r && (double)(d[q[r]] - d[q[r - 1]]) / (b[q[r]] - b[q[r - 1]]) <=
                        (double)(d[i] - d[q[r]]) / (b[i] - b[q[r]]))
      r--;
    q[++r] = i;
    ans = max(ans, f[i]);
  }
  printf("%lld\n", ans);
}
