#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int deq[maxn];
long long f[maxn];
struct node {
  long long x, y, a;
} t[maxn];
bool cmp(const node &A, const node &B) { return A.x < B.x; }
long long cal(int j, int i) {
  return -t[j].x * t[i].y + f[j] + t[i].x * t[i].y - t[i].a;
}
bool check(int i, int j, int k) {
  long long k1 = -t[i].x, b1 = f[i];
  long long k2 = -t[j].x, b2 = f[j];
  long long k3 = -t[k].x, b3 = f[k];
  return 1.0 * (b3 - b1) / (k1 - k3) >= 1.0 * (b2 - b1) / (k1 - k2);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld%lld", &t[i].x, &t[i].y, &t[i].a);
  sort(t + 1, t + n + 1, cmp);
  int l = 0, r = 0;
  deq[r++] = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    while (r - l > 1 && cal(deq[l], i) <= cal(deq[l + 1], i)) l++;
    f[i] = cal(deq[l], i);
    ans = max(ans, f[i]);
    while (r - l > 1 && check(deq[r - 2], deq[r - 1], i)) r--;
    deq[r++] = i;
  }
  printf("%lld\n", ans);
}
