PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000136. Divan mua sô-cô-la (Divan and a Store)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Divan mua sô-cô-la (Divan and a Store)

Divan and a Store

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn chocolate bars costing aia_i. Divan buys only bars priced within the inclusive range [l,r][l,r] and spends at most kk in total. Each bar may be bought at most once. Maximize the number of bars purchased.

Input

The first line contains n,l,r,kn,l,r,k. The next line contains nn prices aia_i.

Output

Print the maximum number of bars.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 1≤l≤r≤1091\le l\le r\le10^9; 1≤k≤1091\le k\le10^9; 1≤ai≤1091\le a_i\le10^9.
  • Subtask 2 (30 points): 1≤n≤401\le n\le 40; 1≤l≤r≤1091\le l\le r\le10^9; 1≤k≤1091\le k\le10^9; 1≤ai≤1091\le a_i\le10^9.
  • Subtask 3 (50 points): 1≤n≤1001\le n\le 100; 1≤l≤r≤1091\le l\le r\le10^9; 1≤k≤1091\le k\le10^9; 1≤ai≤1091\le a_i\le10^9.

Examples

Input

6 3 5 10
1 2 3 4 5 6

Output

2

Explanation

Only bars costing 3,4,53,4,5 are allowed. The two cheapest cost 77; buying all three costs 12>1012>10, hence the maximum is 22.