#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const int N = (int)1e6 + 7;
struct node {
  long long x, y, a;
} a[N];
int n;
long long dp[N];
struct P {
  long long x, y;
  P() {}
  P(long long x, long long y) : x(x), y(y) {}
  P operator-(const P &rhs) const { return P(x - rhs.x, y - rhs.y); }
  bool operator^(const P &rhs) const {
    return (double)x * rhs.y > (double)y * rhs.x;
  }
};
void Init() {
  for (int i = (1); i < (n + 1); ++i)
    scanf("%I64d%I64d%I64d", &a[i].x, &a[i].y, &a[i].a);
  sort(a + 1, a + n + 1, [&](node a, node b) { return a.x < b.x; });
}
int Solve() {
  deque<P> Q;
  Q.push_back(P((a[0].x), (dp[0])));
  for (int i = (1); i < (n + 1); ++i) {
    while ((int)(Q).size() > 1 &&
           (Q[1].y - Q[0].y) > (Q[1].x - Q[0].x) * (a[i].y))
      Q.pop_front();
    dp[i] = Q[0].y - (a[i].y) * Q[0].x + a[i].x * a[i].y - a[i].a;
    P aa((a[i].x), (dp[i]));
    while ((int)(Q).size() > 1 && !((aa - Q[(int)(Q).size() - 2]) ^
                                    (Q.back() - Q[(int)(Q).size() - 2])))
      Q.pop_back();
    Q.push_back(aa);
  }
  long long ans = 0;
  for (int i = (1); i < (n + 1); ++i) ans = max(ans, dp[i]);
  return printf("%I64d\n", ans);
}
int main() {
  while (~scanf("%d", &n)) {
    Init();
    Solve();
  }
  return 0;
}
