#include <bits/stdc++.h>
using namespace std;
char buffer[42000100];
char *it;
template <typename T>
void read(T &x) {
  x = 0;
  while (!isdigit(*it)) it++;
  do x = x * 10 + *it - '0';
  while (isdigit(*++it));
}
int N, p[1000000];
long long X[1000000], Y[1000000], A[1000000], dp[1000000];
struct L {
  long long m, c;
};
long long eval(L f, long long x) { return f.m * x + f.c; }
L q[1000000];
int tail = 0, head = 0;
long long best_line(long long x) {
  while (head - tail >= 2 && eval(q[tail + 1], x) >= eval(q[tail], x)) tail++;
  return eval(q[tail], x);
}
long long intersect(L a, L b) {
  long long num = b.c - a.c;
  long long dem = a.m - b.m;
  return num / dem - ((num ^ dem) < 0 && num % dem);
}
void insert_line(L f) {
  while (head - tail >= 2 &&
         intersect(q[head - 1], f) <= intersect(q[head - 2], q[head - 1]))
    head--;
  q[head++] = f;
}
int main() {
  fread(buffer, 1, 42000100, stdin);
  it = buffer;
  read(N);
  for (int i = 0; i < N; ++i) {
    read(X[i]);
    read(Y[i]);
    read(A[i]);
  }
  iota(p, p + N, 0);
  sort(p, p + N,
       [&](int i, int j) { return X[i] != X[j] ? X[i] < X[j] : Y[i] > Y[j]; });
  q[head++] = {0, 0};
  for (int j = 0, i = p[j]; j < N; ++j, i = p[j]) {
    dp[i] = X[i] * Y[i] - A[i] + best_line(-Y[i]);
    insert_line({X[i], dp[i]});
  }
  printf("%lld\n", *max_element(dp, dp + N));
}
