#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const long long int LINF = 0x3f3f3f3f3f3f3f3f;
const int N = 3000005;
vector<long double> A[N], B[N];
int pont[N];
bool odomeioehlixo(int r1, int r2, int r3, int j) {
  return (B[j][r1] - B[j][r3]) * (A[j][r2] - A[j][r1]) <
         (B[j][r1] - B[j][r2]) * (A[j][r3] - A[j][r1]);
}
void add(long long int a, long long int b, int j) {
  B[j].push_back(b);
  A[j].push_back(a);
  while (B[j].size() >= 3 and
         odomeioehlixo(B[j].size() - 3, B[j].size() - 2, B[j].size() - 1, j)) {
    B[j].erase(B[j].end() - 2);
    A[j].erase(A[j].end() - 2);
  }
}
long long int query(long long int x, int j) {
  if (pont[j] >= B[j].size()) pont[j] = B[j].size() - 1;
  while (pont[j] < B[j].size() - 1 and
         (A[j][pont[j] + 1] * x + B[j][pont[j] + 1] >
          A[j][pont[j]] * x + B[j][pont[j]]))
    pont[j]++;
  return A[j][pont[j]] * x + B[j][pont[j]];
}
const int MAXN = 1000005;
int n;
struct rect {
  long long int x;
  long long int y;
  long long int a;
  bool operator<(const struct rect &other) const {
    if (x != other.x) return x < other.x;
    if (y != other.y) return y < other.y;
    return a < other.a;
  }
};
rect rects[MAXN];
long long int an[MAXN];
long long int ans;
int main() {
  ios::sync_with_stdio(false);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> rects[i].x >> rects[i].y >> rects[i].a;
  }
  sort(rects, rects + n);
  add(0, 0, 0);
  long long int last_y = -LINF;
  long long int last_x = 0;
  for (int i = 0; i < n; i++) {
    assert(-rects[i].y > last_y);
    last_y = -rects[i].y;
    an[i] = query(-rects[i].y, 0) - rects[i].a;
    an[i] += rects[i].y * rects[i].x;
    ans = max(ans, an[i]);
    assert(rects[i].x > last_x);
    last_x = rects[i].x;
    add(rects[i].x, an[i], 0);
  }
  cout << ans << "\n";
  return 0;
}
