#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e6;
struct Line {
  long long k, b;
  Line(long long _k, long long _b) { k = _k, b = _b; }
  long long get_val(long long x) { return k * x + b; }
  long long intersect_x(Line rhs) { return (b - rhs.b) / (rhs.k - k); }
};
struct Rect {
  int x, y;
  long long val;
  bool operator<(const Rect rhs) const { return x < rhs.x; }
};
int N;
Rect A[Maxn + 5];
deque<Line> q;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d %d %lld", &A[i].x, &A[i].y, &A[i].val);
  sort(A + 1, A + N + 1);
  q.push_back(Line(0, 0));
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    while (q.size() >= 2 &&
           q.back().get_val(A[i].y) <= q[q.size() - 2].get_val(A[i].y))
      q.pop_back();
    long long tmp = q.back().get_val(A[i].y) + 1LL * A[i].x * A[i].y - A[i].val;
    ans = max(ans, tmp);
    Line cur(-A[i].x, tmp);
    while (q.size() >= 2 && cur.intersect_x(q[0]) >= q[0].intersect_x(q[1]))
      q.pop_front();
    q.push_front(cur);
  }
  printf("%lld\n", ans);
  return 0;
}
