#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double EPS = 1e-9;
struct rectangle {
  long long x, y, a;
};
bool cmp(rectangle r1, rectangle r2) {
  if (r1.x == r2.x) return r1.y > r2.y;
  return r1.x < r2.x;
}
pair<long long, long long> sub(pair<long long, long long> p1,
                               pair<long long, long long> p2) {
  p1.first -= p2.first;
  p1.second -= p2.second;
  return p1;
}
bool dotnegative(pair<long long, long long> p1, pair<long long, long long> p2) {
  long double val1 = p1.first * 1.0 * p2.first;
  long double val2 = p1.second * 1.0 * p2.second;
  return val1 + val2 < -EPS;
}
long long dot(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.first * p2.first + p1.second * p2.second;
}
bool cross(pair<long long, long long> p1, pair<long long, long long> p2) {
  long double val1 = p1.first * 1.0 * p2.second;
  long double val2 = p2.first * 1.0 * p1.second;
  return val1 > val2;
}
vector<pair<long long, long long> > hull, vecs;
void add_line(pair<long long, long long> p1) {
  while (!vecs.empty() && dotnegative(vecs.back(), sub(p1, hull.back()))) {
    vecs.pop_back();
    hull.pop_back();
  }
  if (!hull.empty()) {
    pair<long long, long long> diff = sub(p1, hull.back());
    vecs.push_back({-diff.second, diff.first});
  }
  hull.push_back(p1);
}
long long query(long long x) {
  pair<long long, long long> pt = {x, 1};
  auto it = lower_bound(vecs.begin(), vecs.end(), pt, cross);
  return dot(pt, hull[it - vecs.begin()]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  rectangle r[n];
  for (int i = 0; i < n; i++) cin >> r[i].x >> r[i].y >> r[i].a;
  sort(r, r + n, cmp);
  long long dp[n];
  add_line({0, 0});
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    dp[i] = r[i].x * r[i].y - r[i].a - query(r[i].y);
    add_line({r[i].x, -dp[i]});
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
}
