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;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
struct line {
  long long m, c;
  line(long long x, long long y) {
    m = x;
    c = y;
  }
};
struct CHT {
  vector<line> vec;
  long long t, ptr;
  void init(long long x) {
    t = x;
    ptr = 0;
    vec.clear();
  }
  inline long long func(long long idx, long long x) {
    long long ret = vec[idx].m * x + vec[idx].c;
    return ret;
  }
  bool bad(line f1, line f2, line f3) {
    __int128 a = (f3.c - f1.c);
    a = a * (f1.m - f2.m);
    __int128 b = (f2.c - f1.c);
    b = b * (f1.m - f3.m);
    if (t == 1) return a <= b;
    if (t == 2) return a >= b;
    if (t == 3) return a >= b;
    if (t == 4) return a <= b;
    assert(0);
  }
  void add(line x) {
    vec.push_back(x);
    long long sz = vec.size();
    while (sz >= 3 && bad(vec[sz - 3], vec[sz - 2], vec[sz - 1])) {
      vec.erase(vec.end() - 2);
      sz--;
    }
  }
  long long ask(long long x) {
    if (vec.empty()) {
      return 0;
    }
    long long lo = 0;
    long long hi = vec.size() - 1;
    long long ret = (t & 1) ? LLONG_MAX : -LLONG_MAX;
    while (lo <= hi) {
      long long mid1 = (lo + (hi - lo) / 3);
      long long mid2 = (hi - (hi - lo) / 3);
      long long ans1 = func(mid1, x);
      long long ans2 = func(mid2, x);
      if (ans1 > ans2) {
        if (t & 1) {
          ret = min(ret, ans2);
          lo = mid1 + 1;
        } else {
          ret = max(ret, ans1);
          hi = mid2 - 1;
        }
      } else {
        if (t & 1) {
          ret = min(ret, ans1);
          hi = mid2 - 1;
        } else {
          ret = max(ret, ans2);
          lo = mid1 + 1;
        }
      }
    }
    return ret;
  }
  long long ask1(long long x) {
    if (vec.empty()) {
      return 0;
    }
    if (ptr >= vec.size()) ptr = vec.size() - 1;
    while (ptr < (vec.size() - 1)) {
      if (t & 1) {
        if (func(ptr, x) > func(ptr + 1, x)) {
          ptr++;
        } else
          break;
      } else {
        if (func(ptr, x) < func(ptr + 1, x)) {
          ptr++;
        } else
          break;
      }
    }
    return func(ptr, x);
  }
};
struct node {
  long long x, y;
  long long val;
};
node vec[1000006];
long long dp[1000006];
bool comp(node a, node b) { return a.x < b.x; }
int main() {
  long long i, j, k, l, m, n, o, r, q;
  long long testcase;
  long long input, flag, tag, ans;
  ios::sync_with_stdio(false);
  cin.tie(), cout.tie();
  while (cin >> n) {
    for (long long i = 0; i < n; i++) {
      cin >> vec[i].x >> vec[i].y >> vec[i].val;
    }
    sort(vec, vec + n, comp);
    CHT cht;
    cht.init(2);
    cht.add(line(0, 0));
    for (long long i = 0; i < n; i++) {
      long long fix = vec[i].x * 1LL * vec[i].y - vec[i].val;
      dp[i] = cht.ask1(vec[i].y) + fix;
      cht.add(line(-vec[i].x, dp[i]));
    }
    ans = 0;
    for (long long i = 0; i < n; i++) ans = max(ans, dp[i]);
    cout << ans << '\n';
  }
}
