#include <bits/stdc++.h>
using namespace std;
typedef struct drpt {
  long long x, y, c;
} DRPT;
typedef struct funct {
  long long x, y, ind;
} FUNCT;
DRPT A[1000005];
FUNCT S[1000005], aux;
int n, i, nrs, j;
long long rez, Dp[1000005];
bool cmp(DRPT a, DRPT b) { return a.x < b.x; }
long double inters(FUNCT f, FUNCT g) { return (1.0 * f.y - g.y) / (g.x - f.x); }
int src(int y) {
  if (nrs == 0) return -1;
  int rez = 0, i;
  for (i = 19; i >= 0; i--)
    if (rez + (1 << i) < nrs &&
        inters(S[rez + (1 << i)], S[rez + (1 << i) + 1]) > 1.0 * y)
      rez = rez + (1 << i);
  rez++;
  return S[rez].ind;
}
void upd(FUNCT f) {
  while (nrs > 1 && inters(S[nrs], S[nrs - 1]) < inters(f, S[nrs - 1])) nrs--;
  S[++nrs] = f;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (i = 1; i <= n; i++) cin >> A[i].x >> A[i].y >> A[i].c;
  sort(A + 1, A + n + 1, cmp);
  for (i = 1; i <= n; i++) {
    Dp[i] = A[i].x * A[i].y - A[i].c;
    j = src(A[i].y);
    if (j != -1)
      Dp[i] = max(Dp[i], Dp[j] + A[i].x * A[i].y - A[j].x * A[i].y - A[i].c);
    aux.x = -A[i].x;
    aux.y = Dp[i];
    aux.ind = i;
    upd(aux);
    rez = max(rez, Dp[i]);
  }
  cout << rez << "\n";
  return 0;
}
