#include <bits/stdc++.h>
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
constexpr ll inf = 1e18;
constexpr int maxx = 1e9 + 57;
struct rect {
  ll x, y, a;
  rect() : x(0), y(0), a(0){};
  rect(ll x, ll y, ll a) : x(x), y(y), a(a){};
};
bool operator<(const rect &a, const rect &b) { return a.x < b.x; }
struct line {
  ll k, b;
  line() : k(0), b(-inf){};
  line(ll k, ll b) : k(k), b(b){};
  ll f(ll x) { return k * x + b; }
};
struct node {
  line func;
  node *left, *right;
  ll l, r;
  node() : l(0), r(0), left(nullptr), right(nullptr), func(){};
  node(ll l, ll r) : l(l), r(r), left(nullptr), right(nullptr), func(){};
};
void add_line(node *v, line f) {
  ll m = (v->l + v->r) >> 1;
  if (v->func.f(m) < f.f(m)) swap(v->func, f);
  if (v->r - v->l > 1) {
    if (f.f(v->l) < v->func.f(v->l)) {
      if (v->right == nullptr) v->right = new node(m, v->r);
      add_line(v->right, f);
    } else {
      if (v->left == nullptr) v->left = new node(v->l, m);
      add_line(v->left, f);
    }
  }
}
ll get_val(node *v, ll x) {
  if (v->r - v->l == 1)
    return v->func.f(x);
  else {
    ll m = (v->l + v->r) >> 1;
    if (x < m) {
      if (v->left == nullptr)
        return v->func.f(x);
      else
        return max(v->func.f(x), get_val(v->left, x));
    } else {
      if (v->right == nullptr)
        return v->func.f(x);
      else
        return max(v->func.f(x), get_val(v->right, x));
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n = 0;
  cin >> n;
  vector<rect> pts(n);
  for (int i = 0; i < n; ++i) {
    ll x = 0, y = 0, a = 0;
    cin >> x >> y >> a;
    pts[i] = rect(x, y, a);
  }
  sort(pts.begin(), pts.end());
  node *t = new node(0, maxx);
  add_line(t, line(0, 0));
  vector<ll> dp(n);
  for (int i = 0; i < n; ++i) {
    dp[i] = get_val(t, pts[i].y) - pts[i].a + pts[i].x * pts[i].y;
    add_line(t, line(-pts[i].x, dp[i]));
  }
  cout << *max_element(dp.begin(), dp.end()) << '\n';
  return 0;
}
