#include <bits/stdc++.h>
using namespace std;
class Cht {
  deque<pair<int, long long>> lines;
  deque<long double> intersections;

 public:
  void addLine(int k, long long b) {
    pair<int, long long> line = {k, b};
    if (!lines.empty() && k == lines.front().first) {
      if (b <= lines.back().second) {
        return;
      }
      lines.pop_front();
      if (!intersections.empty()) {
        intersections.pop_front();
      }
    }
    while (lines.size() > 1) {
      long double x = intersections[0];
      if (1. * line.first * x + line.second >=
          1. * lines.front().first * x + lines.front().second) {
        lines.pop_front();
        intersections.pop_front();
      } else {
        break;
      }
    }
    if (!lines.empty()) {
      intersections.push_front(1. * (lines.front().second - line.second) /
                               (line.first - lines.front().first));
    }
    lines.push_front(line);
  }
  long long getMax(int x) const {
    if (lines.size() == 1) {
      return 1LL * lines[0].first * x + lines[0].second;
    }
    int bl = 1;
    int br = lines.size() - 1;
    int bRes = 0;
    while (bl <= br) {
      int mid = (bl + br) / 2;
      if (intersections[mid - 1] <= x) {
        bRes = mid;
        bl = mid + 1;
      } else {
        br = mid - 1;
      }
    }
    return 1LL * lines[bRes].first * x + lines[bRes].second;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<int, pair<int, long long>>> rs(n);
  for (int i = 0; i < n; i++) {
    cin >> rs[i].first >> rs[i].second.first >> rs[i].second.second;
  }
  sort(rs.begin(), rs.end());
  vector<long long> dp(n);
  Cht cht;
  cht.addLine(0, 0);
  for (int i = 0; i < n; i++) {
    dp[i] = 1LL * rs[i].first * rs[i].second.first - rs[i].second.second +
            cht.getMax(rs[i].second.first);
    cht.addLine(-rs[i].first, dp[i]);
  }
  long long ans = 0;
  for (auto x : dp) {
    ans = max(ans, x);
  }
  cout << ans << endl;
}
