The Fair Nut and Rectangles#11364

The Fair Nut and Rectangles

1 segundo
128 megabytes
Difícil (≈1650)

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

You are given rectangles with vertexes in , (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.

Entrada

The first line contains one integer (1 \leq n \leq 10^6) - the number of rectangles.

Each of the next lines contains three integers x_i, y_i and a_i (1 \leq x_i, y_i \leq 10^9, 0 \leq a_i \leq x_i \cdot y_i).

It is guaranteed that there are no nested rectangles.

Salida

Print the answer to the problem - the maximum value which you can achieve.

prb11364.gif

Ejemplos

Ejemplo 1

Loading
Loading

Ejemplo 2

Loading
Loading