#include <bits/stdc++.h>
using namespace std;
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v);
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const set<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multiset<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2, class T3>
ostream& operator<<(ostream& os, const map<T1, T2, T3>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multimap<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, priority_queue<T1, T2> v) {
  bool f = 1;
  os << "[";
  while (!v.empty()) {
    auto x = v.top();
    v.pop();
    if (!f) os << ", ";
    f = 0;
    os << x;
  }
  return os << "]";
}
template <class T1, class T2>
void printarray(const T1& a, T2 l, T2 r) {
  for (T2 i = l; i <= r; i++) cout << a[i] << (i < r ? " " : "");
}
void cio() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(15);
}
void die() {
  printf("-1\n");
  exit(0);
}
int xx[4] = {1, -1, 0, 0}, yy[4] = {0, 0, 1, -1};
const long long mod = 1e9 + 7;
inline long long f(pair<long long, long long> l, long long x) {
  return l.first * x + l.second;
}
struct LiChaoTree {
  struct Node {
    long long l, r, ln, rn;
    pair<long long, long long> s;
    Node(long long L, long long R, pair<long long, long long> ss) {
      l = L;
      r = R;
      ln = rn = -1;
      s = ss;
    }
  };
  vector<Node> v;
  void init(long long L, long long R) {
    Node nd(L, R, {0, -1e18});
    v.push_back(nd);
  }
  void insert(int node, pair<long long, long long> s) {
    long long L = v[node].l, R = v[node].r;
    pair<long long, long long> l1 = v[node].s;
    pair<long long, long long> l2 = s;
    long long M = (L + R) >> 1;
    if (f(l1, L) == f(l2, L)) {
      if (f(l1, R) >= f(l2, R))
        v[node].s = l1;
      else
        v[node].s = l2;
      return;
    }
    if (f(l1, L) < f(l2, L)) swap(l1, l2);
    if (f(l1, R) >= f(l2, R)) {
      v[node].s = l1;
      return;
    }
    if (f(l1, M) < f(l2, M)) {
      v[node].s = l2;
      if (v[node].ln == -1) {
        Node nd(L, M, l1);
        v[node].ln = (int)v.size();
        v.push_back(nd);
      } else
        insert(v[node].ln, l1);
    } else {
      v[node].s = l1;
      if (v[node].rn == -1) {
        Node nd(M + 1, R, l2);
        v[node].rn = (int)v.size();
        v.push_back(nd);
      } else
        insert(v[node].rn, l2);
    }
  }
  long long query(int node, long long p) {
    if (node == -1) return -1e18;
    long long res = f(v[node].s, p);
    long long M = (v[node].l + v[node].r) >> 1;
    if (v[node].l <= p && p <= M)
      res = max(res, query(v[node].ln, p));
    else
      res = max(res, query(v[node].rn, p));
    return res;
  }
};
int N;
vector<pair<pair<long long, long long>, long long>> v;
long long dp[1000200];
int main() {
  LiChaoTree tree;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    long long x, y, a;
    scanf("%lld%lld%lld", &x, &y, &a);
    v.push_back({{x, y}, a});
  }
  tree.init(1, 1e9);
  sort(v.begin(), v.end());
  long long ans = -1e18;
  tree.insert(0, pair<long long, long long>(0, 0));
  for (int i = 0; i < N; i++) {
    long long x = v[i].first.first, y = v[i].first.second, a = v[i].second;
    long long D;
    D = x * y - a + tree.query(0, y);
    tree.insert(0, pair<long long, long long>(-x, D));
    ans = max(ans, D);
  }
  printf("%lld\n", ans);
}
