#include <bits/stdc++.h>
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const int LOG = 21;
const int NN = (int)1e6 + 5;
const int MAXN = (int)60000 + 5;
const int MOD = (int)1e9 + 7;
const int INF = 1 << 27;
int mul(int x, int y) { return (1LL * x * y) % MOD; }
int add(int x, int y) {
  long long res = x;
  res += y;
  return (res % MOD + MOD) % MOD;
}
int fast_pow(int x, int y) {
  if (y == 0) return 1;
  if (y & 1)
    return mul(x, fast_pow(x, y - 1));
  else {
    int aux = fast_pow(x, y >> 1);
    return mul(aux, aux);
  }
}
int two(int x) { return 1 << x; }
bool contain(int mask, int bit) { return (mask & two(bit)) > 0; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int bit_count(int x) { return x == 0 ? 0 : (x & 1) + bit_count(x >> 1); }
struct rectangle {
  int x, y;
  long long a;
  friend bool operator<(const rectangle& A, const rectangle& B) {
    return A.x < B.x;
  }
} R[NN];
struct line {
  long long c, slope;
  long long evaluation(int x) { return this->slope * x + c; }
  long double intersect(const line& other) {
    return (other.c - this->c + 0.0) / ((long double)this->slope - other.slope);
  }
};
int n;
long long dp[NN];
line deq[NN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%lld", &R[i].x, &R[i].y, &R[i].a);
  }
  sort(R, R + n);
  int fptr = n, bptr = n;
  long long best = 0;
  for (int i = n - 1; i >= 0; i--) {
    while (bptr - fptr >= 2 && deq[bptr - 1].evaluation(R[i].x) <
                                   deq[bptr - 2].evaluation(R[i].x)) {
      bptr--;
    }
    long long v = 0;
    if (bptr - fptr > 0) {
      v = ((0) > (deq[bptr - 1].evaluation(R[i].x))
               ? (0)
               : (deq[bptr - 1].evaluation(R[i].x)));
    }
    dp[i] = v + 1LL * R[i].x * R[i].y - R[i].a;
    best = ((best) > (dp[i]) ? (best) : (dp[i]));
    line cur;
    cur.c = dp[i], cur.slope = -R[i].y;
    while (bptr - fptr >= 2 &&
           deq[fptr].intersect(cur) > deq[fptr + 1].intersect(cur)) {
      fptr++;
    }
    deq[--fptr] = cur;
  }
  printf("%lld\n", best);
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const int LOG = 21;
const int NN = (int)1e6 + 5;
const int MAXN = (int)60000 + 5;
const int MOD = (int)1e9 + 7;
const int INF = 1 << 27;
int mul(int x, int y) { return (1LL * x * y) % MOD; }
int add(int x, int y) {
  long long res = x;
  res += y;
  return (res % MOD + MOD) % MOD;
}
int fast_pow(int x, int y) {
  if (y == 0) return 1;
  if (y & 1)
    return mul(x, fast_pow(x, y - 1));
  else {
    int aux = fast_pow(x, y >> 1);
    return mul(aux, aux);
  }
}
int two(int x) { return 1 << x; }
bool contain(int mask, int bit) { return (mask & two(bit)) > 0; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int bit_count(int x) { return x == 0 ? 0 : (x & 1) + bit_count(x >> 1); }
struct rectangle {
  int x, y;
  long long a;
  friend bool operator<(const rectangle& A, const rectangle& B) {
    return A.x < B.x;
  }
} R[NN];
struct line {
  long long c, slope;
  long long evaluation(int x) { return this->slope * x + c; }
  long double intersect(const line& other) {
    return (other.c - this->c + 0.0) / ((long double)this->slope - other.slope);
  }
};
int n;
long long dp[NN];
line deq[NN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%lld", &R[i].x, &R[i].y, &R[i].a);
  }
  sort(R, R + n);
  int fptr = n, bptr = n;
  long long best = 0;
  for (int i = n - 1; i >= 0; i--) {
    while (bptr - fptr >= 2 && deq[bptr - 1].evaluation(R[i].x) <
                                   deq[bptr - 2].evaluation(R[i].x)) {
      bptr--;
    }
    long long v = 0;
    if (bptr - fptr > 0) {
      v = ((0) > (deq[bptr - 1].evaluation(R[i].x))
               ? (0)
               : (deq[bptr - 1].evaluation(R[i].x)));
    }
    dp[i] = v + 1LL * R[i].x * R[i].y - R[i].a;
    best = ((best) > (dp[i]) ? (best) : (dp[i]));
    line cur;
    cur.c = dp[i], cur.slope = -R[i].y;
    while (bptr - fptr >= 2 &&
           deq[fptr].intersect(cur) > deq[fptr + 1].intersect(cur)) {
      fptr++;
    }
    deq[--fptr] = cur;
  }
  printf("%lld\n", best);
  return 0;
}

```