#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const long long inf = 1e10;
const long long max_n = 1e6 + 1;
struct rec {
  long long x, y, a;
  rec() {}
  rec(long long x, long long y, long long a) : x(x), y(y), a(a) {}
};
vector<pair<long long, long long> > line;
bool inter(pair<long long, long long> a, pair<long long, long long> b,
           pair<long long, long long> c) {
  return (long double)(a.second - b.second) / (b.first - a.first) <
         (long double)(a.second - c.second) / (c.first - a.first);
}
void add(pair<long long, long long> a) {
  while (line.size() && a.first == line.back().first &&
         a.second >= line.back().second)
    line.pop_back();
  while (line.size() >= 2 && inter(a, line.back(), line[line.size() - 2]))
    line.pop_back();
  line.emplace_back(a);
}
long long get(long long x) {
  if (line.empty()) return 0;
  long long l = -1, r = line.size() - 1;
  long long res = 0;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (line[mid].first * x + line[mid].second >
        line[mid + 1].first * x + line[mid + 1].second)
      r = mid;
    else
      l = mid;
  }
  return max(res, line[r].first * x + line[r].second);
}
void solve() {
  long long n;
  cin >> n;
  vector<rec> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i].x >> a[i].y >> a[i].a;
  sort(a.begin(), a.end(), [](rec v1, rec v2) {
    return make_pair(v1.x, v1.y) < make_pair(v2.x, v2.y);
  });
  vector<long long> dp(n);
  for (long long i = 0; i < n; i++) {
    dp[i] = get(-a[i].y) + a[i].x * a[i].y - a[i].a;
    add({a[i].x, dp[i]});
  }
  cout << dp[max_element(dp.begin(), dp.end()) - dp.begin()];
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  cout.precision(10);
  solve();
}
