#include <bits/stdc++.h>
using namespace std;
struct line {
  long long m, b;
  long long eval(long long x) { return m * x + b; }
  long double ix(line o) { return ((long double)o.b - b) / (m - o.m); }
};
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  deque<line> dq;
  dq.push_back({0, 0});
  vector<array<long long, 3>> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  sort((arr).begin(), (arr).end());
  long long ans = 0;
  for (auto [p, q, a] : arr) {
    while (dq.size() > 1 and
           dq[dq.size() - 1].eval(q) <= dq[dq.size() - 2].eval(q))
      dq.pop_back();
    long long f = p * q - a + dq.back().eval(q);
    ans = max(ans, f);
    line l{-p, f};
    while (dq.size() > 1 and l.ix(dq[0]) >= dq[0].ix(dq[1])) dq.pop_front();
    dq.push_front(l);
  }
  cout << ans << "\n";
}
