#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const long long mod = 1e9, inf = 0;
struct Line {
  long long a, b;
  long long y(long long x) { return x * a + b; }
  Line(long long _a, long long _b) {
    a = _a;
    b = _b;
  }
  Line() {
    a = 0;
    b = inf;
  }
};
struct Node {
  Line val;
  Node *l, *r;
  Node() {
    l = nullptr;
    r = nullptr;
  }
  long long y(long long x) { return val.y(x); }
  void expand() {
    if (!l) {
      l = new Node();
      r = new Node();
    }
  }
};
struct Li_Chao {
  Node root;
  void add(Line nw, Node *curr, long long l = 0, long long r = mod) {
    long long m = (l + r) / 2;
    bool a = nw.y(l) > curr->y(l);
    bool b = nw.y(m) > curr->y(m);
    if (b) {
      swap(curr->val, nw);
    }
    if (r - l == 1) {
      return;
    }
    curr->expand();
    if (a != b) {
      add(nw, curr->l, l, m);
    } else {
      add(nw, curr->r, m, r);
    }
  }
  long long get(long long x, Node *curr, long long l = 0, long long r = mod) {
    if (curr == nullptr) {
      return 0;
    }
    long long m = (l + r) / 2;
    if (r - l == 1) {
      return curr->y(x);
    }
    if (x < m) {
      return max(curr->y(x), get(x, curr->l, l, m));
    } else {
      return max(curr->y(x), get(x, curr->r, m, r));
    }
  }
  void add(Line nw) { add(nw, &root); }
  long long get(long long x) { return get(x, &root); }
};
const int MAX_N = 1e6 + 10;
pair<pair<long long, long long>, long long> rect[MAX_N];
Li_Chao lc;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> rect[i].first.first >> rect[i].first.second >> rect[i].second;
  }
  sort(rect, rect + n);
  long long curr = 0,
            ans = rect[0].first.first * rect[0].first.second - rect[0].second;
  lc.add({-rect[0].first.first, ans});
  for (int i = 1; i < n; i++) {
    curr = lc.get(rect[i].first.second);
    curr += rect[i].first.first * rect[i].first.second - rect[i].second;
    ans = max(ans, curr);
    lc.add({-rect[i].first.first, curr});
  }
  cout << ans;
  return 0;
}
