#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const double PI = acos(-1.0);
const int MAX_N = 1000005;
int n;
pair<pair<long long, long long>, long long> v[MAX_N];
long long dp[MAX_N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i].first.first >> v[i].first.second >> v[i].second;
  }
  v[0] = {{0, 0}, 0};
  sort(v + 1, v + 1 + n);
  vector<pair<int, pair<long long, long long>>> cht;
  dp[0] = 0;
  cht.push_back({0, {-INF, INF}});
  for (int i = 1; i <= n; i++) {
    long long x = v[i].first.first, y = v[i].first.second, a = v[i].second;
    int left = -1, right = cht.size(), mid;
    while (true) {
      mid = (left + right) / 2;
      if (cht[mid].second.first < -y && -y <= cht[mid].second.second) {
        break;
      }
      if (cht[mid].second.first >= -y) {
        right = mid;
      } else {
        left = mid;
      }
    }
    mid = cht[mid].first;
    dp[i] = dp[mid] + (x - v[mid].first.first) * y - a;
    long long k = x, b = dp[i];
    while (true) {
      long long nwx = floor((double)(b - dp[cht.back().first]) /
                            (double)(v[cht.back().first].first.first - k));
      if (nwx > cht.back().second.first) {
        cht.back().second.second = nwx;
        cht.push_back({i, {nwx, INF}});
        break;
      } else {
        cht.pop_back();
      }
    }
  }
  long long res = 0;
  for (int i = 0; i <= n; i++) {
    res = max(res, dp[i]);
  }
  cout << res;
  return 0;
}
