#include <bits/stdc++.h>
using namespace std;
int n, h = 0, t = -1;
int que[1000001];
long long int dp[1000001], ans;
struct Rect {
  int r, u;
  long long int cost;
} rec[1000001];
bool comp(Rect a, Rect b) { return a.r < b.r; }
inline double slope(int i, int j) {
  return 1.0 * (dp[i] - dp[j]) / (rec[i].r - rec[j].r);
}
int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%lld", &rec[i].r, &rec[i].u, &rec[i].cost);
  sort(rec + 1, rec + n + 1, comp);
  que[++t] = 0;
  for (int i = 1; i <= n; i++) {
    while (h < t && slope(que[h], que[h + 1]) > rec[i].u) h++;
    dp[i] = dp[que[h]] - (long long int)rec[que[h]].r * rec[i].u;
    dp[i] += (long long int)rec[i].r * rec[i].u - rec[i].cost;
    ans = max(ans, dp[i]);
    while (h < t && slope(que[t - 1], que[t]) < slope(que[t], i)) t--;
    que[++t] = i;
  }
  printf("%lld\n", ans);
  return 0;
}
