#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e6 + 10;
const long long inf = 1e18;
struct Line {
  long long a, b;
  Line() {}
  Line(long long a, long long b) : a(a), b(b) {}
  long long valueAt(long long x) { return a * x + b; }
  long double intersectX(Line l) { return -(long double)(b - l.b) / (a - l.a); }
};
int n;
struct rec {
  long long x, y, a;
  rec() {}
} h[maxN];
long long dp[maxN], res = -inf;
int head = 1e6, tail = 1e6;
Line d[maxN * 2];
void addLine(Line l) {
  while (tail - head >= 2 &&
         l.intersectX(d[head]) >= d[head].intersectX(d[head + 1])) {
    ++head;
  }
  d[--head] = l;
}
long long maxAt(long long x) {
  while (tail - head >= 2 && d[tail - 1].valueAt(x) <= d[tail - 2].valueAt(x)) {
    --tail;
  }
  return d[tail - 1].valueAt(x);
}
inline long long Read() {
  long long x = 0;
  char c = getchar();
  while (c < 48) c = getchar();
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x;
}
void solve() {
  cin >> n;
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> h[i].x >> h[i].y >> h[i].a;
  }
  sort(h + 1, h + n + 1, [](const rec &l, const rec &r) { return l.x < r.x; });
  addLine(Line(0, 0));
  for (int i = 1; i <= (int)(n); ++i) {
    dp[i] = maxAt(h[i].y) + h[i].x * h[i].y - h[i].a;
    uax(res, dp[i]);
    addLine(Line(-h[i].x, dp[i]));
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
