#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
const long long inf = 1e16;
struct str {
  long long x, y, val;
  friend bool operator<(const str A, const str B) {
    if (A.x != B.x) return A.x < B.x;
    return A.y < B.y;
  }
};
long double ccw(pair<long double, long double> A,
                pair<long double, long double> B,
                pair<long double, long double> C) {
  return A.first * (B.second - C.second) + B.first * (C.second - A.second) +
         C.first * (A.second - B.second);
}
int n;
str a[MAXN];
long long dp[MAXN];
long long sol;
vector<pair<long long, long long> > hull;
long long calc(int x, int mid) {
  return (long long)-(a[x].y * hull[mid].first) + hull[mid].second;
}
long long query(int x) {
  int lo = 0, hi = ((int)hull.size()) - 1;
  while (lo < hi) {
    int mid = (lo + hi) >> 1;
    if (calc(x, mid) < calc(x, mid + 1))
      lo = mid + 1;
    else
      hi = mid;
  }
  return calc(x, lo);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n + 1; ++i) cin >> a[i].x >> a[i].y >> a[i].val;
  sort(a + 1, a + n + 1);
  hull.push_back(make_pair(0, 0));
  for (int i = 1; i < n + 1; ++i) {
    long long val = query(i);
    long long k = a[i].x * a[i].y - a[i].val;
    val = k + val;
    while (((int)hull.size()) > 1 &&
           ccw(hull[((int)hull.size()) - 2], hull.back(),
               make_pair(a[i].x, val)) >= 0)
      hull.pop_back();
    hull.push_back(make_pair(a[i].x, val));
    sol = max(sol, val);
  }
  cout << sol;
}
