The Best Pizza

Interview

Time limit1sMemory limit128 MB

Summary
Choose any subset of toppings, each costing B, to maximize total calories divided by total price, and print the floor of that ratio.
Level

Medium4 of 10

Topics
Greedy, Sorting, Brute force, Math
Solved
No attempts yet

Problem

Sang-geun has a pizza delivered for dinner every evening. Starting this month he wants to order only the "best pizza". The best pizza is the pizza with the highest number of calories per won among all pizzas that can be ordered at this shop. There may be several best pizzas.

A pizza is made by placing toppings on a single piece of dough. The shop offers NN kinds of toppings, and you may add as many of them as you like. However, you cannot add the same topping more than once, and you may also add no toppings at all.

The dough costs AA won, and every topping costs BB won regardless of its kind. Therefore, if you choose kk toppings (0≤k≤N)(0 \le k \le N), the pizza costs A+B×kA + B \times k won. The calories of a pizza equal the calories of the dough plus the calories of all chosen toppings.

Given the price of the dough, the price of one topping, the calories of the dough, and the calories of each topping, find the number of calories per won of the best pizza.

Input

The first line contains the number of topping kinds NN (1≤N≤100)(1 \le N \le 100).

The second line contains the price of the dough AA and the price of one topping BB, separated by a space. (1≤A,B≤1000)(1 \le A, B \le 1000)

The third line contains the calories of the dough CC. (1≤C≤10000)(1 \le C \le 10000)

Each of the next NN lines contains the calories of one topping DiD_i, one per line. (1≤Di≤10000)(1 \le D_i \le 10000)

Output

Print the number of calories per won of the best pizza on the first line. Discard the fractional part and print it as an integer.

Hint

For example, suppose the dough costs 12 won, each topping costs 2 won, the dough has 200 calories, and there are three toppings with 50, 300, and 100 calories. If you add the toppings with 300 and 100 calories, the total calories are 200+300+100=600200 + 300 + 100 = 600 and the price is 12+2×2=1612 + 2 \times 2 = 16 won. This pizza has 600/16=37.5600 / 16 = 37.5 calories per won, which is the maximum, so it is a best pizza. Discarding the fractional part gives 37.

Examples2

  1. Example 1

    Input
    3
    12 2
    200
    50
    300
    100
    
    Expected output
    37
    
  2. Example 2

    Input
    4
    20 3
    900
    300
    100
    400
    1300
    
    Expected output
    100