#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <typename T, typename U>
static inline void amin(T& x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T& x, U y) {
  if (x < y) x = y;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a < b) ? a : b; }
inline long long f(pair<long long, pair<long long, long long>> a) {
  return a.first * a.second.first - a.second.second;
}
inline long long val(pair<long long, long long> a, long long b) {
  return -a.first * b + a.second;
}
long long solve() {
  long long n;
  cin >> n;
  vector<pair<long long, pair<long long, long long>>> v;
  for (long long i = 0; i < n; i++) {
    long long x, y, a;
    cin >> x >> y >> a;
    v.push_back({x, {y, a}});
  }
  sort(v.begin(), v.end());
  n = v.size();
  long long dp[n + 1];
  memset(dp, 0, sizeof(dp));
  dp[0] = f(v[0]);
  deque<pair<long long, long long>> d;
  d.push_front({v[0].first, dp[0]});
  for (long long i = 1; i < n; i++) {
    dp[i] = f(v[i]);
    while (d.size() >= 2) {
      auto a1 = d.front();
      d.pop_front();
      auto a2 = d.front();
      if (val(a2, v[i].second.first) > val(a1, v[i].second.first)) {
        dp[i] = max(dp[i], f(v[i]) + val(a2, v[i].second.first));
      } else {
        d.push_front(a1);
        dp[i] = max(dp[i], f(v[i]) + val(a1, v[i].second.first));
        break;
      }
    }
    dp[i] = max(dp[i], f(v[i]) + val(d.front(), v[i].second.first));
    while (d.size() >= 2) {
      auto a1 = d.back();
      d.pop_back();
      auto a2 = d.back();
      long long m = v[i].first, c = dp[i];
      if ((long double)(c - a1.second) / (-m + a1.first) >
          (long double)(c - a2.second) / (-m + a2.first)) {
        d.push_back(a1);
        break;
      }
    }
    d.push_back({v[i].first, dp[i]});
  }
  cout << *max_element(dp, dp + n);
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
