#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
vector<pair<long long, pair<long long, long long> > > v;
long long n, dp[1000006], ans;
deque<pair<long long, long long> > ch;
void AddThisNigga(long long id, long long c) {
  if (ch.size()) {
    while (ch.size() >= 2) {
      pair<long long, long long> p = *--ch.end();
      pair<long long, long long> pp = *-- --ch.end();
      long long ig = p.first, cc = dp[p.first];
      long long ip = (cc - c) / (-v[id].first + v[ig].first);
      long long igg = pp.first, ccc = dp[pp.first];
      long long ipp = (ccc - cc) / (-v[ig].first + v[igg].first);
      if (ipp <= ip) {
        ch.pop_back();
        continue;
      }
      break;
    }
    pair<long long, long long> p = *--ch.end();
    long long ig = p.first, cc = dp[p.first];
    long long ip = (cc - c) / (-v[id].first + v[ig].first);
    ch.push_back({id, ip});
  } else
    ch.push_back({id, c / v[id].first});
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    v.push_back({x, {y, z}});
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    long long x = v[i].first, y = v[i].second.first, z = v[i].second.second;
    dp[i] = x * y - z;
    long long l = 0, r = ch.size(), mid;
    while (l < r) {
      mid = (l + r) / 2;
      if (ch[mid].second < y)
        r = mid;
      else
        l = mid + 1;
    }
    l--;
    if (l >= 0) {
      long long id = ch[l].first;
      dp[i] = max(dp[i], dp[id] - v[id].first * y + x * y - z);
    }
    AddThisNigga(i, dp[i]);
    ans = max(ans, dp[i]);
  }
  cout << ans;
}
