#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 1000006;
struct ban {
  int x, y;
  long long z;
};
bool operator<(const ban& a, const ban& b) {
  if (a.x < b.x) return true;
  if (a.x > b.x) return false;
  return a.y < b.y;
}
int n;
ban a[N];
struct line {
  long long b, k;
  line() {}
  line(long long b, long long k) {
    this->b = b;
    this->k = k;
  }
  long long yat(long long x) { return b + k * x; }
};
double hat(const line& t1, const line& t2) {
  return (t2.b - t1.b) / (double)(t1.k - t2.k);
}
long long dp[N];
void solv() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%lld", &a[i].x, &a[i].y, &a[i].z);
  }
  sort(a + 1, a + n + 1);
  deque<line> t;
  deque<double> v;
  for (int i = 1; i <= n; ++i) {
    dp[i] = a[i].x * 1LL * a[i].y - a[i].z;
    if (!t.empty()) {
      int ans = 0;
      int l = 0, r = ((int)(v).size()) - 1;
      while (l <= r) {
        int m = (l + r) / 2;
        if (v[m] <= a[i].y) {
          ans = m + 1;
          l = m + 1;
        } else
          r = m - 1;
      }
      dp[i] = max(dp[i], a[i].x * 1LL * a[i].y - a[i].z + t[ans].yat(a[i].y));
    }
    while (t.size() >= 2 && hat(t.front(), line(dp[i], -a[i].x)) > v.front()) {
      t.pop_front();
      v.pop_front();
    }
    if (!t.empty()) v.push_front(hat(t.front(), line(dp[i], -a[i].x)));
    t.push_front(line(dp[i], -a[i].x));
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans = max(ans, dp[i]);
  printf("%lld\n", ans);
}
int main() {
  solv();
  return 0;
}
