#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1001000;
const long long INF = 0x25f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
long long x[NMAX], y[NMAX], a[NMAX];
int N;
long long MM = 1.1e9;
namespace isdh {
struct Line {
  long long m, b, start;
  Line() {}
  Line(long long x, long long y) : m(x), b(y), start(-INFLL) {}
  long long isecX(const Line& o) const {
    if (m == o.m) return -INFLL;
    long long num = (b - o.b), den = o.m - m;
    return num / den + ((num ^ den) >= 0 && num % den);
  }
  long long solve(const long long& x) const { return m * x + b; }
  bool operator<(const Line& o) const { return (m == o.m ? b < o.b : m < o.m); }
};
struct HullStatic {
  vector<Line> lines;
  HullStatic() {}
  HullStatic(vector<Line> init) {
    sort(init.begin(), init.end());
    for (auto& l : init) insert(l);
  }
  inline void insert(Line l) {
    while (lines.size()) {
      if (l.isecX(lines.back()) <= lines.back().start) {
        lines.pop_back();
      } else {
        break;
      }
    }
    if (lines.size()) {
      l.start = l.isecX(lines.back());
      lines.push_back(move(l));
    } else {
      l.start = -INFLL;
      lines.push_back(move(l));
    }
  }
  long long solve(long long x) {
    int lo = 0, hi = lines.size() - 1;
    while (lo < hi) {
      int m = (lo + hi + 1) / 2;
      if (lines[m].start <= x) {
        lo = m;
      } else {
        hi = m - 1;
      }
    }
    return lines[lo].solve(x);
  }
};
}  // namespace isdh
inline char get() {
  static char buf[100000], *S = buf, *T = buf;
  if (S == T) {
    T = (S = buf) + fread(buf, 1, 100000, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
inline long long read() {
  static char c;
  long long x = 0;
  for (c = get(); c < '0' || c > '9'; c = get())
    ;
  for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
  return x;
}
long long ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  N = read();
  vector<vector<long long>> v(N, vector<long long>(3));
  for (auto& vv : v) {
    for (auto& vvv : vv) {
      vvv = read();
    }
  }
  sort(v.begin(), v.end());
  for (int i = 1; i <= N; ++i) {
    x[i] = v[i - 1][0];
    y[i] = v[i - 1][1];
    a[i] = v[i - 1][2];
  }
  isdh::HullStatic env;
  env.insert(isdh::Line(0, 0));
  for (int i = N; i >= 0; --i) {
    long long f = env.solve(MM - x[i]);
    ans = max(f, ans);
    long long b = f + (x[i] - MM) * y[i] - a[i];
    long long m = y[i];
    if (i != 0) {
      env.insert(isdh::Line(m, b));
    }
  }
  cout << ans << endl;
  return 0;
}
