#GD0000175. Nước chanh cho bữa tiệc (Party Lemonade)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Nước chanh cho bữa tiệc (Party Lemonade)
Party Lemonade
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A shop sells types of lemonade bottles. Type has a volume of exactly liters and costs units of money. There is an unlimited supply of every type, and you may buy multiple bottles of the same type.
You need at least liters for a party. Buying more than liters is allowed if it is cheaper. Find the minimum total cost.
Input
Line 1 contains integers : the number of bottle types and the minimum volume in liters.
Line 2 contains exactly integers ; is the price of a bottle of volume liters.
Output
Print one integer: the minimum total cost of buying at least liters.
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
4 12
20 30 70 90
Output
150
Explanation
The bottle sizes are liters with prices . One -liter bottle and two -liter bottles provide liters for . Two -liter bottles cost and one -liter plus one -liter costs . No cheaper purchase reaches the required volume, so the output is .