#P10708. Minimum Ticket Cost

    ID: 12739 Type: Default 1000ms 256MiB

Minimum Ticket Cost

Minimum Ticket Cost

You are a tourist planning to explore a city over n days. On the ith day, you need to take ai train rides. There are two types of train tickets available:

  • Single Ride Ticket: Costs x dollars and allows you to ride one train.
  • One-Day Ticket: Costs y dollars and allows unlimited train rides for that day.

Your task is to determine the minimum total cost of purchasing the tickets over all n days.

The cost for each day is calculated as follows:

\[ \text{cost}_{i} = \min(a_i \times x,\ y) \quad \text{for } i = 1, 2, \dots, n \]

The answer is the sum of the daily costs.

inputFormat

The first line contains three integers n, x, and y (1 ≤ n ≤ 105, 1 ≤ x, y ≤ 109).

The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 109), where ai denotes the number of train rides on the ith day.

outputFormat

Output a single integer representing the minimum total cost required to purchase the train tickets for all days.

sample

3 2 5
1 3 1
10

</p>