#P1211D. Teams

    ID: 4928 Type: RemoteJudge 3000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>*special problembinary searchgreedymath*2000

Teams

No submission language available for this problem.

Description

There are nn table bowling players, the rating of the ii-th player equals rir_i. Compose a maximum number of teams in a such way that:

  • each player belongs to at most one team;
  • each team contains exactly a+ba+b players;
  • each team contains a group of aa players with the same rating and a group of bb players with another same rating, which must be kk times larger than the rating of the players in the first group.

For example, if n=12n=12, r=[1,1,2,2,2,2,2,3,3,4,6,6]r=[1, 1, 2, 2, 2, 2, 2, 3, 3, 4, 6, 6], a=1a=1, b=2b=2, k=2k=2, you can compose two teams with ratings [1,2,2][1, 2, 2] and one team with ratings [3,6,6][3, 6, 6]. So, the maximum number of teams is 33.

Find the maximum number of teams by given n,r1rn,a,bn, r_1 \dots r_n, a, b and kk to compose in respect to the given requirements.

The first line of the input contains four integers nn, aa, bb and kk (1n,a,b31051 \le n,a,b \le 3\cdot10^5, 2k10002 \le k \le 1000). The second line contains the sequence of player's ratings — integers r1,r2,,rnr_1, r_2, \dots, r_n (1ri1061 \le r_i \le 10^6).

Print only one integer — the maximum number of teams that can be composed from nn given players.

Input

The first line of the input contains four integers nn, aa, bb and kk (1n,a,b31051 \le n,a,b \le 3\cdot10^5, 2k10002 \le k \le 1000). The second line contains the sequence of player's ratings — integers r1,r2,,rnr_1, r_2, \dots, r_n (1ri1061 \le r_i \le 10^6).

Output

Print only one integer — the maximum number of teams that can be composed from nn given players.

Samples

Sample Input 1

12 1 2 2
1 1 2 2 2 2 2 3 3 4 6 6

Sample Output 1

3

Sample Input 2

14 1 1 3
3 3 1 1 9 9 2 3 6 6 3 18 3 18

Sample Output 2

6

Sample Input 3

1 2 3 10
1000000

Sample Output 3

0