#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 15;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;
const __int128 is_query = -(1LL << 62);
struct Line {
  __int128 m, b;
  mutable multiset<Line>::iterator it, end;
  const Line* succ(multiset<Line>::iterator it) const {
    return (++it == end ? NULL : &*it);
  }
  bool operator<(const Line& rhs) const {
    if (rhs.b != is_query) return m < rhs.m;
    const Line* s = succ(it);
    if (!s) return 0;
    return b - s->b < (s->m - m) * rhs.m;
  }
};
struct HullDynamic : public multiset<Line> {
  bool bad(iterator y) {
    iterator z = next(y);
    if (y == begin()) {
      if (z == end()) return false;
      return y->m == z->m && y->b <= z->b;
    }
    iterator x = prev(y);
    if (z == end()) return y->m == x->m && y->b <= x->b;
    return (x->b - y->b) * (z->m - y->m) >= (y->b - z->b) * (y->m - x->m);
  }
  iterator next(iterator y) { return ++y; }
  iterator prev(iterator y) { return --y; }
  void add(__int128 m, __int128 b) {
    iterator y = insert((Line){m, b});
    y->it = y;
    y->end = end();
    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));
  }
  __int128 eval(__int128 x) {
    Line l = *lower_bound((Line){x, is_query});
    return l.m * x + l.b;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<pair<long long, long long>, long long>> xy(n);
  for (int i = (0); i < (int)(n); i++)
    cin >> xy[i].first.first >> xy[i].first.second >> xy[i].second;
  sort((xy).begin(), (xy).end());
  vector<long long> dp(n);
  HullDynamic cht;
  cht.add(0, 0);
  for (int i = (0); i < (int)(n); i++) {
    long long x, y, a;
    x = xy[i].first.first, y = xy[i].first.second;
    a = xy[i].second;
    long long act = cht.eval(y);
    dp[i] = x * y - a + act;
    cht.add(-x, dp[i]);
  }
  long long ans = dp[0];
  for (int i = (0); i < (int)(n); i++) ans = max(ans, dp[i]);
  cout << ans << "\n";
  return 0;
}
