#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int MAXN = 1e6 + 10;
pair<pair<long long int, long long int>, long long int> a[MAXN];
struct Line {
  long long int m, c;
  long long int eval(long long int x) { return m * x + c; }
  long double intersectX(Line l) {
    long double r = (long double)(c - l.c) / (long double)(l.m - m);
    return r;
  }
};
void solve() {
  long long int n;
  cin >> n;
  for (long long int i = (1); i <= (n); ++i) {
    cin >> a[i].first.first >> a[i].first.second;
    cin >> a[i].second;
  }
  sort(a + 1, a + n + 1);
  long long int ans = 0;
  deque<Line> dq;
  dq.push_front({0, 0});
  for (long long int i = (1); i <= (n); ++i) {
    while (dq.size() >= 2 && dq.back().eval(a[i].first.second) <=
                                 dq[dq.size() - 2].eval(a[i].first.second))
      dq.pop_back();
    long long int first = dq.back().eval(a[i].first.second) +
                          a[i].first.first * a[i].first.second - a[i].second;
    ans = max(ans, first);
    Line curr = {-a[i].first.first, first};
    while (dq.size() >= 2 && curr.intersectX(dq[0]) >= dq[0].intersectX(dq[1]))
      dq.pop_front();
    dq.push_front(curr);
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  for (long long int i = (1); i <= (t); ++i) {
    solve();
  }
}
