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.
import java.util.*;
import java.io.*;

// Solution

public class Main 
{    
  public static void main (String[] argv) 
  {
	  new Main();
  } 
     
     
  
  boolean test = false;  
  
  final int MOD = 1000000007;
  
  
  class Rec implements Comparable<Rec>{
      int x, y;
      long s;
      
      public Rec(int x, int y, long a) {
          this.x = x;
          this.y = y;
          this.s = 1L * x * y - a;
      }
      
      @Override
      public int compareTo(Rec o) {
         return x - o.x;   
      }
  }
  
 
  Rec[] recs;
  long[] dp;
  
  public Main()   {
	 FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
	 //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
     
     
     
     int n = in.nextInt();
     recs = new Rec[n];
     for (int i = 0; i < n; i++) {
         int x = in.nextInt();
         int y = in.nextInt();
         long a = in.nextLong();
         recs[i] = new Rec(x, y, a);
     }
     
     Arrays.sort(recs);
     
     // Let dp[i] be the maximum value achievable given a[i] is chosen.
     // denote Rec : (x, y, a), try for all j as the last rectangle chosen before i: 
     // then dp[i] = Max_over_j_for_j_less_than_i:  dp[j] + (x - x[j]) * y - a = dp[j] - x[j] * y + x * y - a = dp[j] - x[j] * y + s
     // Also, can choose none of the rectangle, where dp[i] = s
     dp = new long[n];
     int l = 0, r = 0;
     int[] sk = new int[n];
     
     long best = 0;
     for (int i = 0; i < n; i++) {
         long cur = recs[i].s;
         int x = recs[i].x;
         int y = recs[i].y;
         long s = cur;
         
         if (cur <= 0) continue;
         
         // System.out.println("i = " + i + ", cur = " + cur);
          
         if (l == r) {
             sk[l] = i;
             r++;
             dp[i] = cur;
             //System.out.println("i = " + i + ", cur = " + cur + ", l==r dp = " + cur);
         }else {
             while (r - l > 1 && leqIntersect(y, sk[l], sk[l+1])) ++l;
             
             int j = sk[l];
             cur = max(cur, dp[j] - 1L * recs[j].x * y + s);             
        // System.out.println("i = " + i + ", cur = " + cur + ", eval at " + j);
             dp[i] = cur;
            
         
             // add dp[i] to sk
             if (cur > dp[r-1]) {
                while (r - l > 1 && better(cur, x, sk[r-1], sk[r - 2])) --r;
                
                sk[r++] = i;
             }
         }
          best = max(best, dp[i]);
     }
     System.out.println(best);
  }
  
  private boolean better(long dpi, int x, int r, int rr) {
      double one= (double)1.0;
      return one * (dp[r] - dp[rr]) * (x - recs[r].x)  <= one * (dpi - dp[r]) * (recs[r].x - recs[rr].x);
  }
  
  //return true iff  x <= intersection_of_line_l and ll
  private boolean leqIntersect(int x, int l, int ll) {
      if (recs[ll].x - recs[l].x > 0)
        return 1L * (recs[ll].x - recs[l].x) * x <= dp[ll] - dp[l];
      else 
        return 1L * (recs[ll].x - recs[l].x) * x >= dp[ll] - dp[l];
  }
 
  private int mod_add(int a, int b) {
      int v = a + b;
      if (v >= MOD) v -= MOD;
      return v;
  }
  
  
  private long overlap(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
      if (x1 > x3) return overlap(x3, y3, x4, y4, x1, y1, x2, y2);
      
      if (x3 > x2 || y4 < y1 || y3 > y2) return 0L;
      
      //(x3, ?, x2, ?)
      int yL = Math.max(y1, y3);
      int yH = Math.min(y2, y4); 
      int xH = Math.min(x2, x4);
      
      return f(x3, yL, xH, yH);
  }
  //return #black cells in rectangle
  private long f(int x1, int y1, int x2, int y2) {
      long dx = 1L + x2 - x1;
      long dy = 1L + y2 - y1;
      if (dx % 2 == 0 || dy % 2 == 0 || (x1 + y1) % 2 == 0) 
          return 1L * dx * dy / 2;
      return 1L * dx * dy / 2 + 1;
  }
  
  private int dist(int x, int y, int xx, int yy) {
      return abs(x - xx) + abs(y - yy);
  }
  
  private boolean less(int x, int y, int xx, int yy) {
      return x < xx || y > yy;
  }
  
  private int mul(int x, int y) {
      return (int)(1L * x * y % MOD);
  }
  
  private int add(int x, int y) {
      return (x + y) % MOD;
  }
  
 
  
  private int nBit1(int v) {
      int v0 = v;
      int c = 0;
      while (v != 0) {
          ++c;
          v = v & (v - 1);
      }
      return c;
  }
  
  private long abs(long v) {
      return v > 0 ? v : -v;
  }
  
  private int abs(int v) {
      return v > 0 ? v : -v;
  }
  
  private int common(int v) {
      int c = 0;
      while (v != 1) {
          v = (v >>> 1);
          ++c;
      }
      
      return c;
  }
  
  private void reverse(char[] a, int i, int j) {
      while (i < j) {
          swap(a, i++, j--);
      }
  }
  
  private void swap(char[] a, int i, int j) {
      char t = a[i];
      a[i] = a[j];
      a[j] = t;
  }
  
  private int gcd(int x, int y) {
      if (y == 0) return x;
      return gcd(y, x % y);
  }
  private long gcd(long x, long y) {
      if (y == 0) return x;
      return gcd(y, x % y);
  }
  private int max(int a, int b) {
      return a >  b ? a : b;
  }
  
  private long max(long a, long b) {
      return a >  b ? a : b;
  }
  
  private int min(int a, int b) {
      return a >  b ? b : a;
  }
  
  private long min(long a, long b) {
      return a >  b ? b : a;
  }
  
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader(BufferedReader in)
        {            
            br = in;
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    String line = br.readLine();
                    if (line == null || line.length() == 0) return "";
                    st = new StringTokenizer(line);
                }
                catch (IOException  e)
                {
                    return "";
                    //e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                return "";
                //e.printStackTrace();
            }
            return str;
        }
    }
}