← 返回题目列表

Codeforces · 36/C

C. 碗

中文机器翻译题面 查看原题

有一次,Petya 心情很好,决定帮妈妈洗碗。水槽里有n个脏碗。从几何角度来看,每个碗看起来都像一个钝圆锥体。 We can disregard the width of the walls and bottom. Petya 自然地将干净的碗一个一个地放在另一个上,即。 e.使它们的垂直轴重合(见图)。您将收到 Petya 洗碗的顺序。 Determine the height of the construction, i.e. the distance from the bottom of the lowest bowl to the top of the highest one.

输入

第一个输入行包含整数 n (1 ≤ n ≤ 3000)。以下 n 行每行包含 3 个整数 h、r 和 R (1 ≤ h ≤ 10000, 1 ≤ r < R ≤ 10000)。它们是碗的高度、底部半径和顶部半径。盘子是按照 Petya 把它们放在桌子上的顺序排列的。

输出

输出板堆的高度,精确到至少 10 - 6。

示例

输入 #1

2
40 10 50
60 20 30

输出 #1

70.00000000

输入 #2

3
50 30 80
35 25 70
40 10 90

输出 #2

55.00000000