#include <bits/stdc++.h>
using namespace std;
const int NUM = 3e5 + 5;
const int mod = 1e9 + 7;
long long INF = 1e18;
struct line {
  long long k, b;
  long double active;
};
long double intersect(line a, line b) {
  return (long double)(b.b - a.b) / (a.k - b.k);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long a[n];
  vector<pair<pair<long long, long long>, long long> > res;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y >> a[i];
    res.push_back(make_pair(make_pair(x, y), a[i]));
  }
  sort(res.begin(), res.end());
  long long dp[n], x[n], y[n];
  for (int i = 0; i < n; i++)
    x[i] = res[i].first.first, y[i] = res[i].first.second, a[i] = res[i].second;
  vector<line> st;
  dp[0] = x[0] * y[0] - a[0];
  line l;
  l.active = INF;
  l.k = -x[0];
  l.b = dp[0];
  st.push_back(l);
  for (int i = 1; i < n; i++) {
    int l = 0, r = st.size();
    while (r - l > 1) {
      int m = (l + r) / 2;
      if (st[m].active >= y[i])
        l = m;
      else
        r = m;
    }
    dp[i] = x[i] * y[i] - a[i] + st[l].b + st[l].k * y[i];
    dp[i] = max(x[i] * y[i] - a[i], dp[i]);
    line nw;
    nw.k = -x[i];
    nw.b = dp[i];
    while (st.size()) {
      long double x = intersect(nw, st[st.size() - 1]);
      if (x >= st[st.size() - 1].active)
        st.erase(st.begin() + st.size() - 1);
      else
        break;
    }
    nw.active = intersect(nw, st[st.size() - 1]);
    st.push_back(nw);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
  cout << ans;
  return 0;
}
