1185: 小船过河

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:13 Solved:7

Description

有n个人需要过河,只有一艘船,最多能乘2人,船的运行速度为2人中较慢一人的速度,过去后还需一个人把船划回来,把n个人运到对岸,最少需要多久。

Input

第一行 1 <= n <= 100
接下来n行,代表n个人的速度。

Output

n个人运到对岸,最少需要多久。

Sample Input Copy

5
1
2
4
5
8

Sample Output Copy

20

Source/Category