#include <bits/stdc++.h>
using namespace std;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
void setIO(string name) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin.exceptions(istream::failbit);
}
const int inf = 0x3f3f3f3f, mod = 1e9 + 7;
const long long is_query = -(1LL << 62);
struct line {
  long long m, b;
  mutable function<const line *()> succ;
  bool operator<(const line &rhs) const {
    if (rhs.b != is_query) {
      return m < rhs.m;
    }
    const line *s = succ();
    if (!s) {
      return false;
    }
    long long x = rhs.m;
    return b - s->b < (s->m - m) * x;
  }
};
struct dynamic_hull : public multiset<line> {
  const long long inf = LLONG_MAX;
  bool bad(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) {
        return false;
      }
      return y->m == z->m && y->b <= z->b;
    }
    auto x = prev(y);
    if (z == end()) {
      return y->m == x->m && y->b <= x->b;
    }
    long long v1 = (x->b - y->b);
    if (y->m == x->m) {
      v1 = x->b > y->b ? inf : -inf;
    } else {
      v1 /= (y->m - x->m);
    }
    long long v2 = (y->b - z->b);
    if (z->m == y->m) {
      v2 = y->b > z->b ? inf : -inf;
    } else {
      v2 /= (z->m - y->m);
    }
    return v1 >= v2;
  }
  void insert_line(long long m, long long b) {
    auto y = insert({m, b});
    y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
    if (bad(y)) {
      erase(y);
      return;
    }
    while (next(y) != end() && bad(next(y))) {
      erase(next(y));
    }
    while (y != begin() && bad(prev(y))) {
      erase(prev(y));
    }
  }
  long long eval(long long x) {
    auto l = *lower_bound((line){x, is_query});
    return l.m * x + l.b;
  }
};
int main() {
  setIO("1");
  int n;
  cin >> n;
  vector<pair<pair<long long, long long>, long long>> a(n);
  vector<long long> dp(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first.first >> a[i].first.second >> a[i].second;
  }
  sort(a.begin(), a.end());
  dynamic_hull cht;
  cht.insert_line(0, 0);
  long long sol = 0;
  for (int i = 0; i < n; ++i) {
    dp[i] = cht.eval(a[i].first.second) + a[i].first.first * a[i].first.second -
            a[i].second;
    cht.insert_line(-a[i].first.first, dp[i]);
    sol = max(sol, dp[i]);
  }
  cout << sol << "\n";
  return 0;
}
