#include <bits/stdc++.h>
using namespace std;
long long res, cur, n, dp[1000006];
struct info {
  long long x, y;
  long long a;
  bool operator<(const info &b) const { return x < b.x; }
};
struct P {
  long long x, y;
  P operator+(const P &a) const { return (P){x + a.x, y + a.y}; }
  P operator-(const P &a) const { return (P){x - a.x, y - a.y}; }
  long long operator*(const P &a) const {
    double u, v;
    if (x == 0 && a.x == 0) return 0;
    if (x == 0) {
      if (y == 0) return 0;
      return 2 * ((y > 0 && a.x < 0) || (y < 0 && a.x > 0)) - 1;
    }
    if (a.x == 0) {
      if (a.y == 0) return 0;
      return 2 * ((a.y > 0 && x > 0) || (a.y < 0 && x < 0)) - 1;
    }
    u = y;
    u /= x;
    v = a.y;
    v /= a.x;
    if (u == v) return 0;
    return (2 * (v > u) - 1) *
           (2 * ((x > 0 && a.x > 0) || (x < 0 && a.x < 0)) - 1);
  }
  long long V(long long pos, int k) { return (pos - x) * k + y; }
};
vector<info> var;
vector<P> vex;
int main() {
  scanf("%d", &n);
  var.resize(n + 1);
  var[0] = (info){0, INT_MAX, 0};
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %lld", &var[i].x, &var[i].y, &var[i].a);
  }
  sort(var.begin(), var.end());
  vex.push_back((P){0, 0});
  for (int i = 1; i <= n; i++) {
    while (cur < vex.size() - 1 &&
           vex[cur].V(var[i].x, var[i].y) < vex[cur + 1].V(var[i].x, var[i].y))
      cur++;
    dp[i] = vex[cur].V(var[i].x, var[i].y) - var[i].a;
    P lar = (P){var[i].x, dp[i]};
    while (vex.size() > 1 &&
           (lar - vex[vex.size() - 2]) *
                   (vex[vex.size() - 1] - vex[vex.size() - 2]) <=
               0) {
      if (cur == vex.size() - 1) cur--;
      vex.pop_back();
    }
    vex.push_back(lar);
  }
  for (int i = 0; i <= n; i++) res = max(res, dp[i]);
  printf("%lld", res);
  return 0;
}
