#include <bits/stdc++.h>
using namespace std;
struct _ {
  long long x, y, a;
  bool operator<(const _ &ob) const { return x < ob.x; }
} a[1000010];
long long b[1000010];
struct point {
  long long x, y;
};
long long dp[1000010];
deque<point> q;
long long calc(point x, long long k) { return x.x * -k + x.y; }
long long slope(point a, point b) { return (b.y - a.y) / (b.x - a.x + 1e-10); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int i;
  for (i = 1; i <= n; ++i) {
    cin >> a[i].x >> a[i].y >> a[i].a;
  }
  sort(a + 1, a + 1 + n);
  for (i = 1; i <= n; ++i) b[i] = a[i].x * a[i].y - a[i].a;
  q.push_back((point){0, 0});
  for (i = 1; i <= n; ++i) {
    long long d = b[i] / a[i].y;
    while (q.size() > 1) {
      if (calc(q[1], a[i].y) >= calc(q[0], a[i].y))
        q.pop_front();
      else
        break;
    }
    dp[i] = calc(q[0], a[i].y) + b[i];
    point tmp = (point){a[i].x, dp[i]};
    while (q.size() > 1) {
      if (slope(q[q.size() - 2], q.back()) < slope(q.back(), tmp))
        q.pop_back();
      else
        break;
    }
    q.push_back(tmp);
  }
  long long max_ = 0;
  for (i = 1; i <= n; ++i) max_ = max(max_, dp[i]);
  cout << max_ << '\n';
  return 0;
}
