#include <bits/stdc++.h>
using namespace std;
int n, pointer;
struct rectangle {
  long long x, y, a;
} rec[1000001];
vector<pair<long long, long long> > convex;
long long dp[1000001];
bool cmp(rectangle u, rectangle v) { return (u.x < v.x); }
bool bad(pair<long long, long long> l1, pair<long long, long long> l2,
         pair<long long, long long> l3) {
  if (l3.first == l2.first) {
    cout << "-1";
    exit(0);
    return (l3.second > l2.second);
  }
  return (long double)(l2.second - l1.second) / (l1.first - l2.first) <
         (long double)(l3.second - l1.second) / (l1.first - l3.first);
}
void add(pair<long long, long long> l) {
  convex.push_back(l);
  while (convex.size() >= 3 &&
         bad(convex[convex.size() - 3], convex[convex.size() - 2],
             convex[convex.size() - 1]))
    convex.erase(convex.end() - 2);
}
long long query(long long x) {
  while (pointer < convex.size() - 1 &&
         convex[pointer + 1].first * x + convex[pointer + 1].second >
             convex[pointer].first * x + convex[pointer].second)
    pointer++;
  return convex[pointer].first * x + convex[pointer].second;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%lld%lld%lld", &rec[i].x, &rec[i].y, &rec[i].a);
  sort(rec + 1, rec + 1 + n, cmp);
  dp[1] = rec[1].x * rec[1].y - rec[1].a;
  add({-rec[1].x, dp[1]});
  pointer = 0;
  for (int i = 2; i <= n; i++) {
    dp[i] = rec[i].x * rec[i].y - rec[i].a;
    dp[i] = max(dp[i], -rec[i].a + query(rec[i].y) + rec[i].x * rec[i].y);
    if (i < n) add({-rec[i].x, dp[i]});
  }
  printf("%lld\n", *max_element(dp + 1, dp + 1 + n));
  return 0;
}
