Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/ochkoz-kasrli-yukxalta

Divisible loads

Medium 2000 ms 128 MB 66%
Share

A bag can hold at most $W$ kg. There are $n$ loads: the value of the $i$-th load is $v_{i}$ and its weight is $w_{i}$ kg. Loads may be divided: if $x$ kg of the $i$-th load is taken ($0 \le x \le w_{i}$), its value is

$$v_{i} * \frac{x}{w_{i}}$$

Find the largest total value of the loads in the bag.

Diagram of filling the bag with divisible loads

Input

The first line contains two positive integers: $n$ and $W$. Each of the next $n$ lines contains two positive integers: $v_{i}$ and $w_{i}$.

Output

One real number — the largest total value, with exactly $3$ digits after the decimal point (for example, 240.000).

Note

$1 \le n \le 10^{5}$
$1 \le v_{i}, w_{i} \le 10^{6}$
$1 \le W \le 10^{11}$

Examples

Input #1
3 50
60 10
100 20
120 30
Output #1
240.000
Input #2
2 5
10 10
3 1
Output #2
7.000

Sign in to submit a solution

Signing up is free and takes a minute.