Fractional Knapsack


You are packing a bag with weight capacity CC. There are nn items, and the ii-th item has value viv_i and weight wiw_i.

You do not have to take an entire item. You may take any fraction of an item, and both its weight and value scale proportionally. In particular, if you take weight xx from item ii (where 0≤x≤wi0 \le x \le w_i), then you gain value x⋅vi/wix \cdot v_i / w_i.

What is the maximum total value you can obtain?

Input

The first line contains two integers nn and CC, the number of items and the knapsack capacity.

The next nn lines each contain two integers viv_i and wiw_i, the value and weight of an item.

Output

Print the maximum obtainable value as a floating-point number.

Your answer will be accepted if it has absolute or relative error at most 10−310^{-3}.

Constraints

  • 1≤n≤2⋅1051 \le n \le 2 \cdot 10^5
  • 1≤C≤1061 \le C \le 10^6
  • 1≤vi,wi≤1061 \le v_i, w_i \le 10^6
  • If the exact answer is written as a reduced fraction p/qp/q, then both pp and qq fit in signed 64-bit integers.

Example 1

Input 1
3 3
8 6
9 4
10 5
Output 1
6.75
Explanation

The second item has the highest value density: 9/49 / 4. With capacity 33, take 3/43/4 of that item and gain (3/4)⋅9=27/4(3 / 4) \cdot 9 = 27 / 4.

Example 2

Input 2
4 8
6 3
15 5
14 7
9 6
Output 2
21.0
Explanation

Take the first two items completely. Their total weight is 3+5=83 + 5 = 8, and their total value is 6+15=216 + 15 = 21.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.