Time limit
1s
Memory limit
128 MB
Each bowl is a frustum with height h, bottom radius r, and top radius R. Its top is open, its side is a straight line, and its thickness is ignored. Given N bowls, choose an order for stacking them on the same central axis so that the total height is as small as possible. Find the minimum possible height.
The first line contains the number of bowls n. Each of the next n lines contains three integers h, r, and R describing one bowl. h is the height, r is the bottom radius, and R is the top radius.
Print the minimum possible height on the first line. Output the integer obtained by discarding the fractional part of the actual minimum height.