LogiQuest

268. Fractional Knapsack

EasyGreedySorting

Items can be taken in fractions. Print the maximum value that fits in capacity W, rounded to exactly 2 decimal places.

Input format

Line 1: n W Next n lines: value weight

Output format

The maximum value, e.g. 240.00

Example 1

Input

3 50
60 10
100 20
120 30

Output

240.00

Example 2

Input

2 10
500 30
10 1

Output

166.67

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.

Loading the MyLoginn IDE…