#include <bits/stdc++.h>
using namespace std;
long long ans[1000005];
long long n;
struct cht {
  vector<pair<long long, long long> > v;
  long long pt = 0;
  long long val(long long pos, long long x) {
    return v[pos].first * x + v[pos].second;
  }
  bool lmao(pair<long long, long long> p0, pair<long long, long long> p1,
            pair<long long, long long> p2) {
    double lel = 1.0 * (p1.second - p0.second) * (p1.first - p2.first) -
                     1.0 * (p2.second - p1.second) * (p0.first - p1.first) >=
                 1e-7;
    if (lel > 0) return true;
    return false;
  }
  void add(long long first, long long second) {
    for (pair<long long, long long> hic = {first, second};
         v.size() > 1 && lmao(hic, v[v.size() - 1], v[v.size() - 2]);
         v.pop_back())
      ;
    v.push_back({first, second});
  }
  long long get(long long x) {
    for (pt = min(pt, (long long)v.size() - 1);
         pt + 1 < (long long)v.size() && val(pt, x) < val(pt + 1, x); pt++)
      ;
    return val(pt, x);
  }
} C;
pair<long long, pair<long long, long long> > first[1000005];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  C.add(0, 0);
  for (long long i = 1; i <= n; i++) {
    cin >> first[i].first >> first[i].second.first >> first[i].second.second;
  }
  sort(first + 1, first + n + 1);
  long long hihi = -1000000000000000000;
  for (long long i = 1; i <= n; i++) {
    ans[i] = C.get(first[i].second.first) - first[i].second.second +
             first[i].first * first[i].second.first;
    C.add(-first[i].first, ans[i]);
    hihi = max(hihi, ans[i]);
  }
  cout << hihi;
}
