Russian Dolls

No attempts yetTime limit3sMemory limit128 MB

Problem

A Russian doll is a wooden souvenir where a smaller doll sits inside a bigger one. Take the whole set apart and look at the dolls one by one. Doll ii has an outer volume outiout_i, the volume it occupies in space, and an inner volume iniin_i, the volume of the empty space inside it. You may put one doll inside another when the outer volume of the first doll is strictly less than the inner volume of the second one. Two dolls that go inside the same doll cannot lie side by side, so they must be nested one inside the other.

Every doll charges for the empty space left in it. You pay costicost_i for each unit of empty space that belongs directly to doll ii, that is, the part of its inner space that the doll placed directly inside it does not occupy. A doll with nothing inside it has all of iniin_i empty. You may arrange the dolls any way the rules allow, and you do not have to nest all of them. Find the smallest total cost you have to pay.

Input

The first line contains an integer NN (1N10001 \le N \le 1000), the number of dolls. The ii-th of the next NN lines contains three integers outiout_i, iniin_i, costicost_i (1ini<outi10001 \le in_i < out_i \le 1000, 1costi10001 \le cost_i \le 1000), the outer volume, the inner volume, and the cost of one unit of empty space of doll ii.

Output

Print one integer PP, the minimum cost you have to pay.