#include <bits/stdc++.h>
using namespace std;
bool desc_sort(const int& lhs, const int& rhs) { return lhs > rhs; }
bool desc_pii_sort(const pair<int, int>& lhs, const pair<int, int>& rhs) {
  return lhs > rhs;
}
bool second_sort(const pair<int, int>& lhs, const pair<int, int>& rhs) {
  pair<int, int> a, b;
  a.first = lhs.second;
  a.second = lhs.first;
  b.first = rhs.second;
  b.second = rhs.first;
  return a < b;
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> second) {
  os << "{ ";
  for (auto s : second) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
inline long long fast_expo(long long base, long long power,
                           long long modulo = 1e0) {
  base %= modulo;
  if (base < 0LL) base += modulo;
  long long x = base, cnt = power, ans = 1LL;
  while (cnt) {
    if (cnt & 1LL) ans = (ans * x) % modulo;
    x = (x * x) % modulo;
    cnt >>= 1LL;
  }
  return ans;
}
inline long long inv(long long base, long long modulo = 1e0) {
  return fast_expo(base, modulo - 2LL, modulo);
}
struct line {
  long long m, c;
  line(long long m1, long long c1) {
    m = m1;
    c = c1;
  }
  long long eval(long long x) { return m * x + c; }
  long double intersectX(line l) { return (long double)(c - l.c) / (l.m - m); }
};
deque<line> dq;
void insert(line l) {
  bool done = 0;
  while (!dq.empty()) {
    line r = dq.back();
    if (r.m == l.m) {
      if (r.c < l.c) {
        dq.pop_back();
      }
    } else {
      dq.pop_back();
      if (dq.empty()) {
        dq.push_back(r);
        dq.push_back(l);
        done = 1;
        break;
      } else {
        if (l.intersectX(r) >= r.intersectX(dq.back())) {
          continue;
        } else {
          dq.push_back(r);
          dq.push_back(l);
          done = 1;
          break;
        }
      }
    }
  }
  if (!done) {
    dq.push_back(l);
    done = 1;
  }
}
long long query(long long x) {
  while (dq.size() > 1) {
    line r = dq.front();
    dq.pop_front();
    if (dq.front().eval(x) < r.eval(x)) {
      dq.push_front(r);
      return r.eval(x);
    }
  }
  return dq.front().eval(x);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  pair<pair<long long, long long>, long long> v[n + 1];
  for (int i = 1; i <= n; i++)
    cin >> v[i].first.first >> v[i].first.second >> v[i].second;
  sort(v + 1, v + n + 1);
  long long dp[n + 1];
  long long ans = 0;
  dq.push_front(line(0, 0));
  for (int i = 1; i <= n; i++) {
    dp[i] = query(v[i].first.second);
    dp[i] += v[i].first.second * v[i].first.first - v[i].second;
    insert(line(-v[i].first.first, dp[i]));
    ans = max(ans, dp[i]);
  }
  cout << (ans) << "\n";
  return 0;
}
