Under construction

Still being built. Things may change

Metro

Interview

Time limit2sMemory limit1024 MB

Summary
Given n cards with balances a_i and p extra burles to distribute, find the maximum number of metro rides at fee k per ride.
Level

Medium5 of 10

Topics
Greedy, Sorting, Math
Solved
No attempts yet

Statement

Pafnutiy wants to use the metro to reach his destination.

To pass through a turnstile, he must use a special SLON card (Subterranean Lowcost Orientational Network). Each card has a non-negative integer balance, the number of burles recorded on it. If a card has at least kk burles, it can pass the turnstile, and its balance then decreases by kk. If the balance is less than kk, the card cannot be used for the turnstile.

Initially, Pafnutiy has nn cards, and card ii has balance aia_i. He has also saved pp burles and can distribute this money among the cards in any way. Formally, if he adds addi≥0add_i \ge 0 burles to card ii, then add1+add2+…+addn≤padd_1 + add_2 + \ldots + add_n \le p must hold. Money cannot be moved between cards. A card balance grows only from part of these pp burles and shrinks only when the card passes the turnstile.

Find the maximum number of times Pafnutiy can ride the metro if he distributes the pp burles optimally.

Input

The first line contains three integers nn, pp, and kk (1≤n≤1051 \leq n \leq 10^5, 0≤p≤10180 \leq p \leq 10^{18}, 1≤k≤1091 \leq k \leq 10^9): the number of cards, the saved amount, and the fee for one passage.

The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai≤1090 \leq a_i \leq 10^9): the card balances.

Output

Print one integer: the maximum number of times Pafnutiy can ride the metro.

Hint

In the first example, Pafnutiy can initially ride only 3 times. But if he adds 1 burle to the first, second, or third card, he can ride 4 times.

In the second example, 1000 burles are only enough to bring the balances of both cards to 2000 burles.

Examples2

  1. Example 1

    Input
    5 1 4
    7 7 3 4 1
    
    Expected output
    4
    
  2. Example 2

    Input
    2 1000 2000
    1299 1701
    
    Expected output
    2