Talent Show

Choose a group of cows with total weight at least W maximizing the ratio of total talent to total weight, and print floor(1000A).

Medium6Dynamic programmingBinary searchGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

Farmer John brings his NN cows, numbered 11 through NN, to the county fair for the annual bovine talent show. Cow ii has weight wiw_i and talent level tit_i, both integers.

The rules of this year's show are new.

(i) The group of cows entered into the show must have total weight at least WW. The rule exists so that one outstanding cow cannot win on its own.

(ii) The group with the largest ratio of total talent to total weight wins.

All of Farmer John's cows together weigh at least WW, so a group satisfying rule (i) always exists. Determine the largest ratio of total talent to total weight he can reach with such a group.

Input

The first line contains NN (1N2501 \le N \le 250) and WW (1W10001 \le W \le 1000). Each of the next NN lines describes one cow with two integers wiw_i (1wi1061 \le w_i \le 10^6) and tit_i (1ti1031 \le t_i \le 10^3).

Output

Let AA be the largest ratio of total talent to total weight reachable by a group whose total weight is at least WW. Print the floor of 1000A1000A, which keeps the output integer. The floor operation discards the fractional part and rounds down to an integer, and leaves a value that is already an integer unchanged.

Hint

In the first example the best ratio for a single cow belongs to the cow with talent 11 and weight 10. The group needs total weight at least 15, so the best group adds the cow with talent 21 and weight 20. That group has ratio (11+21)/(10+20)=32/30=1.0666(11+21)/(10+20) = 32/30 = 1.0666\ldots, and multiplying by 1000 and taking the floor gives 1066.