#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
vector<array<long long, 3>> v;
deque<array<long long, 2>> bond;
vector<long long> dp(N);
void insertline(long long a, long long b) {
  while (bond.size() >= 2 &&
         (((bond[bond.size() - 1][1] - bond[bond.size() - 2][1]) /
           (bond[bond.size() - 2][0] - bond[bond.size() - 1][0])) <=
          (((bond[bond.size() - 1][1] - b) / (a - bond[bond.size() - 1][0])))))
    bond.pop_back();
  bond.push_back({a, b});
}
long long query(long long x) {
  while (bond.size() >= 2 &&
         ((bond[0][0] * x + bond[0][1]) <= (bond[1][0] * x + bond[1][1]))) {
    bond.pop_front();
  }
  long long temp = (bond[0][0] * x + bond[0][1]);
  return temp;
}
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    v.push_back({a, b, c});
  }
  sort(v.begin(), v.end());
  long long ans = 0;
  bond.push_back({0, 0});
  for (int i = 0; i < n; i++) {
    dp[i] = v[i][0] * v[i][1] - v[i][2] + query(v[i][1]);
    ans = max(ans, dp[i]);
    insertline(-v[i][0], dp[i]);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
