cho.sh
Notes
Loading...

Woodcutter Dasom

Time limit

2s

Memory limit

128 MB

Problem

Dasom has several logs. A local timber buyer will purchase only log pieces that all have the same length in a single sale. Dasom can cut logs at a workshop to make pieces of one chosen length. Each cut costs C won, and each unit length of wood sells for W won.

If the target length is L, a log of length x can produce floor(x / L) pieces. If x is divisible by L, producing those pieces requires floor(x / L) - 1 cuts. Otherwise, it requires floor(x / L) cuts, leaving an unused remainder. If the sale amount from a log is not greater than the cutting cost needed for that log, that log may be left unused.

Given the lengths of the logs Dasom currently has, compute the maximum amount of money Dasom can earn.

Input

The first line contains N, the number of logs, C, the cost of one cut, and W, the price per unit length of wood. Each of the next N lines contains the length of one log.

N is a positive integer no greater than 50. C and W are positive integers no greater than 10,000. Every log length is a positive integer no greater than 10,000.

Output

Print the maximum amount of money Dasom can earn.