fractional_knapsack

Problem Statement

The supermarket has N items, numbered from 1 to N. Item i has a weight of wi and a value of vi.

You decided to go to the supermarket with a knapsack that can hold up to a weight of S. Unlike other supermarkets, this is a special one. It allows all customers to split split their food in however way they want based on weight. So if someone splits an apple of weight 5 and value 3 to an apple of weight 2 and 3, the values of the split apples will be 3/5 * 2 and 3/5 * 3 respectively.

You do not care what type of item uou take, only the value. Calculate the maximum value of items you can take with your knapsack.

Constraints

  • All values in input are integers, but output may be a long double
  • 1 ≤ N ≤ 106
  • 1 ≤ wi , vi ≤ 109
  • 1 ≤ S ≤ 1015

Input

Input in given in the following way

N S

w1 v1

w2 v2

w3 v3

. .

. .

wn vn

Output

Print the highest possible sum of values of the items you can take. (10 decimal places)

Sample input 1

5 10

2 3

3 2

1 4

5 4

3 3

Sample output 1

13.2000000000

Sample testcase 1 explanation

You can take the 1st item fully, 3rd time fully, 4th item partially and the 5th item fully.

Submitting to 'fractional_knapsack'


You're not logged in! Click here to login


Submitting to 'fractional_knapsack'


You're not logged in! Click here to login


Submitting .cpp to 'fractional_knapsack'


You're not logged in! Click here to login

Time Limit: 1 Seconds
Memory Limit: 1024MB
Your best score: 0
Source: Classic Problem

Subtask Score
1 100
2 0