luogu#P10708. [NOISG 2024 Prelim] Tourist

[NOISG 2024 Prelim] Tourist

Background

Translated from NOI SG 2024 Prelim A.Tourist.

Problem Description

You are a tourist, and you want to visit a city in nn days.

You have already planned your trip. On day ii, you need to take the train aia_i times.

You learned that there are two types of train tickets:

  • Single-ride ticket: pay xx yuan to buy one single-ride ticket, which allows you to take the train 11 time.
  • Day pass: pay yy yuan to buy one day pass, which allows you to take the train any number of times within one day.

Please find the minimum total cost to buy train tickets.

Input Format

The first line contains three integers n,x,yn, x, y.

The second line contains nn integers. The ii-th integer represents aia_i.

Output Format

Output one integer in one line, representing the minimum cost.

3 4 9
2 3 2

25

Hint

Sample #1 Explanation

Your trip lasts for 33 days. A single-ride ticket costs 44 yuan, and a day pass costs 99 yuan.

On the first day, buy 22 single-ride tickets, costing 88 yuan.

On the second day, buy 11 day pass, costing 99 yuan.

On the third day, buy 22 single-ride tickets, costing 88 yuan.

The minimum cost is 8+9+8=258 + 9 + 8 = 25 yuan.

Constraints

Subtask\text{Subtask} Score Special Properties
00 Sample
11 100100 None

For 100%100\% of the testdata, 1n,x10001 \le n, x \le 1000, 1y1061 \le y \le 10^6, 1ai1041 \le a_i \le 10^4.

Translated by ChatGPT 5