#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
const long long int mod = 1e9 + 7;
struct node {
  long long int x, y, a;
} p[maxn];
long long int f[maxn];
long long int x(int i) { return p[i].x; }
long long int y(int i) { return f[i]; }
double rate(int i, int j) {
  return ((double)y(i) - (double)y(j)) / ((double)x(i) - (double)x(j));
}
bool cmp(node a, node b) { return a.x < b.x; }
int Q[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d%I64d", &p[i].x, &p[i].y, &p[i].a);
  }
  sort(p + 1, p + n + 1, cmp);
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    f[i] = -p[i].a + p[i].x * p[i].y;
    ans = max(ans, f[i]);
  }
  int head, tail;
  head = tail = 1;
  int j;
  Q[1] = 1;
  for (int i = 2; i <= n; i++) {
    while (head < tail && rate(Q[head], Q[head + 1]) > p[i].y) head++;
    j = Q[head];
    f[i] = max(f[i], f[j] + (p[i].x - p[j].x) * p[i].y - p[i].a);
    ans = max(ans, f[i]);
    while (head < tail && rate(Q[tail - 1], Q[tail]) < rate(Q[tail], i)) tail--;
    Q[++tail] = i;
  }
  printf("%I64d\n", ans);
  return 0;
}
