The Fair Nut got stacked in planar world. He should solve this task to get out.

You are given n rectangles with vertexes in (0, 0), (x_i, 0), (x_i, y_i), (0, y_i). For each rectangle, you are also given a number a_i. Choose some of them that the area of union minus sum of a_i of the chosen ones is maximum.

It is guaranteed that there are no nested rectangles.

Nut has no idea how to find the answer, so he asked for your help.

Input

The first line contains one integer n (1 ≤ n ≤ 10^6) — the number of rectangles.

Each of the next n lines contains three integers x_i, y_i and a_i (1 ≤ x_i, y_i ≤ 10^9, 0 ≤ a_i ≤ x_i ⋅ y_i).

It is guaranteed that there are no nested rectangles.

Output

In a single line print the answer to the problem — the maximum value which you can achieve.

Examples

Input


3
4 4 8
1 5 0
5 2 10


Output


9

Input


4
6 2 4
1 6 2
2 4 3
5 3 8


Output


10

Note

In the first example, the right answer can be achieved by choosing the first and the second rectangles.

In the second example, the right answer can also be achieved by choosing the first and the second rectangles.
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1001000;
const long double INF = 1e50;
long long x[NMAX], y[NMAX], a[NMAX];
int N;
long long MM = 1.1e9;
const long double EPS = 1e-5;
namespace n0 {
int sgn = -1;
struct line {
  long double m, b, left;
  line() : left(-INF) {}
  line(long double m, long double b) : m(m), b(b), left(-INF) {}
  long double eval(long double x) const { return m * x + b; }
  bool operator<(const line& o) const {
    if (m == o.m) return sgn * b < sgn * o.b;
    return sgn * m > sgn * o.m;
  }
  long double intersect(const line& o) const {
    if (abs(m - o.m) < EPS) return INF;
    return (o.b - b) / (m - o.m);
  }
};
struct comp_left {
  bool operator()(const line& l, const line& r) const {
    if (l.left == r.left) {
      if (l.m == r.m) return l.b < r.b;
      return l.m < r.m;
    }
    return l.left < r.left;
  }
};
struct envelope {
  set<line> lines;
  set<line, comp_left> top;
  long double query(long double x) {
    line l;
    l.left = x;
    set<line, comp_left>::iterator it = --top.lower_bound(l);
    return it->eval(x);
  }
  void recompute(line nl, line l, long double xl) {
    top.erase(nl);
    lines.erase(nl);
    if (nl.m != l.m) {
      nl.left = xl;
      top.insert(nl);
      lines.insert(nl);
    }
  }
  void insert(line l) {
    if (lines.size() == 1) {
      if (l < *lines.begin()) {
        recompute(*lines.begin(), l, l.intersect(*lines.begin()));
      } else {
        if (l.m == lines.begin()->m) return;
        l.left = l.intersect(*lines.begin());
      }
    } else if (lines.size() > 1) {
      auto i = lines.lower_bound(l);
      if (i != lines.begin() && i != lines.end()) {
        auto j = i;
        j--;
        long double x = i->intersect(*j);
        if (sgn * l.eval(x) >= sgn * (i->eval(x))) return;
      }
      for (int k = 0; k < 2; k++) {
        int s = (k ? -1 : 1);
        i = lines.lower_bound(l);
        bool bcond = (k ? i != lines.end() : i != lines.begin());
        if (!bcond) continue;
        auto j = i;
        if (k)
          j++;
        else {
          j = --i;
          j--;
        }
        while (true) {
          bool econd = (k ? j == lines.end() : i == lines.begin());
          long double x12 = i->intersect(l), x13 = j->intersect(l);
          if (!econd && s * x13 > s * x12 - EPS) {
            auto it = i;
            if (k)
              i++, j++;
            else
              i--, j--;
            top.erase(*it);
            lines.erase(it);
          } else {
            if (k)
              recompute(*i, l, i->intersect(l));
            else
              l.left = l.intersect(*i);
            break;
          }
        }
      }
    }
    lines.insert(l);
    top.insert(l);
  }
};
}  // namespace n0
long long ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> N;
  vector<vector<long long>> v(N, vector<long long>(3));
  for (auto& vv : v) {
    for (auto& vvv : vv) {
      cin >> vvv;
    }
  }
  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];
  }
  n0::envelope env;
  env.insert(n0::line(0, 0));
  for (int i = N; i >= 0; --i) {
    long long f = env.query(MM - x[i]) + .4;
    ans = max(f, ans);
    long double b = f + (long double)(x[i] - MM) * y[i] - a[i];
    long double m = y[i];
    if (i != 0) {
      env.insert(n0::line(m, b));
    }
  }
  cout << ans << endl;
  return 0;
}
