#include <bits/stdc++.h>
using namespace std;
struct Rec {
  long long first, second, a;
};
bool operator<(Rec a, Rec b) { return a.second < b.second; }
pair<long long, long long> deq[1000001];
int dlen = 0, d0 = 0;
double cross(pair<long long, long long> a, pair<long long, long long> b) {
  return 1. * (b.first - a.first) / (b.second - a.second);
}
long long query(long long first) {
  while (d0 + 1 < dlen && first < cross(deq[d0 + 1], deq[d0])) d0++;
  return deq[d0].first - deq[d0].second * first;
  long long r = 0;
  for (int i = 0; i < dlen; i++)
    r = max(r, deq[i].first - deq[i].second * first);
  return r;
}
void add(long long v, long long second) {
  if (v < deq[dlen - 1].first) return;
  while (dlen >= 2 && cross({v, second}, deq[dlen - 2]) >
                          cross(deq[dlen - 1], deq[dlen - 2]))
    dlen--;
  deq[dlen++] = {v, second};
}
Rec r[1000000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> r[i].first >> r[i].second >> r[i].a;
  sort(r, r + n);
  deq[dlen++] = {0, 0};
  for (int i = 0; i < n; i++) {
    long long v = query(r[i].first) + r[i].first * r[i].second - r[i].a;
    add(v, r[i].second);
  }
  cout << query(0) << endl;
}
