#include <bits/stdc++.h>
using namespace std;
struct CHT {
  struct Line {
    long long slope, yi;
    Line(long long slope, long long yi) : slope(slope), yi(yi) {}
    long long calc(long long x) { return slope * x + yi; }
    long long intersect(Line b) {
      return ceil((1.0 * b.yi - yi) / (slope - b.slope));
    }
  };
  deque<pair<Line, long long>> dq;
  void insert(long long slope, long long yi) {
    Line l(slope, yi);
    while (dq.size() > 1 && dq.back().second <= l.intersect(dq.back().first)) {
      dq.pop_back();
    }
    if (dq.empty()) {
      dq.push_back({l, yi});
    } else {
      dq.push_back({l, l.intersect(dq.back().first)});
    }
  }
  long long query(long long x) {
    while (dq.size() > 1) {
      if (dq[0].first.calc(x) <= dq[1].first.calc(x))
        dq.pop_front();
      else
        break;
    }
    return dq[0].first.calc(x);
  }
};
const int maxN = 1e6 + 5;
long long table[maxN];
CHT cht;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  tuple<long long, long long, long long> data[n];
  for (int x = 0; x < n; x++) {
    long long a, b, c;
    cin >> a >> b >> c;
    data[x] = make_tuple(a, b, c);
  }
  sort(data, data + n);
  cht.insert(0, 0);
  long long ans = 0;
  for (int x = 0; x < n; x++) {
    long long a = get<0>(data[x]), b = get<1>(data[x]), c = get<2>(data[x]);
    table[x] = cht.query(b) + (a * b) - c;
    ans = max(ans, table[x]);
    cht.insert(-a, table[x]);
  }
  cout << ans << "\n";
  return 0;
}
