#include <bits/stdc++.h>
using namespace std;
vector<complex<long long int> > hull, vecs;
long long int dot(complex<long long int> a, complex<long long int> b) {
  return (conj(a) * b).real();
}
long long int cross(complex<long long int> a, complex<long long int> b) {
  return (conj(a) * b).imag();
}
long double ang(complex<long long int> a, complex<long long int> b) {
  long double q1 = atan2(a.imag(), a.real());
  long double q2 = atan2(b.imag(), b.real());
  q1 -= q2;
  return cos(q1);
}
bool comparion(complex<long long int> a, complex<long long int> b) {
  return cross(a, b) > 0;
}
void add_line(long long int k, long long int b) {
  complex<long long int> nw = {k, b};
  while (!vecs.empty() && ang(vecs.back(), nw - hull.back()) < 0) {
    hull.pop_back();
    vecs.pop_back();
  }
  if (!hull.empty()) {
    complex<long long int> im = {0, -1};
    vecs.push_back(im * (nw - hull.back()));
  }
  hull.push_back(nw);
}
long long int get(long long int x) {
  complex<long long int> query = {x, 1};
  auto it = lower_bound(vecs.begin(), vecs.end(), query, comparion);
  return dot(query, hull[it - vecs.begin()]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int ans = 0;
  pair<pair<long long int, long long int>, long long int> p[n];
  for (long long int i = 0; i < n; i++) {
    cin >> p[i].first.first >> p[i].first.second >> p[i].second;
  }
  sort(p, p + n);
  add_line(0, 0);
  for (long long int i = 0; i < n; i++) {
    long long int x = get(-p[i].first.second);
    x += p[i].first.first * p[i].first.second;
    x -= p[i].second;
    ans = max(x, ans);
    add_line(p[i].first.first, x);
  }
  cout << ans << '\n';
}
