#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 998244353;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 998244353) a -= 998244353;
}
template <typename T>
inline T const &MAX(T const &a, T const &b) {
  return a > b ? a : b;
}
template <typename T>
inline T const &MIN(T const &a, T const &b) {
  return a < b ? a : b;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 998244353;
    a = a * a % 998244353, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c, b >>= 1;
  }
  return ans;
}
using namespace std;
const double eps = 1e-8;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1000000 + 10, maxn = 200000 + 10, inf = 0x3f3f3f3f;
struct node {
  long long x, y, c;
  bool operator<(const node &rhs) const { return x < rhs.x; }
} a[N];
long long dp[N];
int q[N];
inline long long x(int i) { return a[i].x; }
inline long long y(int i) { return dp[i]; }
inline long double slope(int a, int b) {
  return (long double)(y(b) - y(a)) / (x(b) - x(a));
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld%lld", &a[i].x, &a[i].y, &a[i].c);
  sort(a + 1, a + 1 + n);
  int head = 1, last = 1;
  q[head] = 0;
  for (int i = 1; i <= n; i++) {
    while (head < last && slope(q[head], q[head + 1]) > (long double)a[i].y)
      head++;
    int te = q[head];
    dp[i] = dp[te] + a[i].x * a[i].y - a[i].c - a[i].y * a[te].x;
    while (head < last && slope(q[last - 1], q[last]) < slope(q[last], i))
      last--;
    q[++last] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
  printf("%lld\n", ans);
  return 0;
}
