LearnPy Hub
← Arena
EasyRating 900

Pouring Tea

A teapot holds w ml. There are n girls and n boys and 2n cups with given capacities. Each girl gets x ml and each boy 2x ml. Find the largest total tea you can pour (it can't overflow cups or the teapot). Print it with 6 decimals.

Input

n and w, then 2n cup capacities.

Output

One number.

Sample 1

Input
2 4
1 1 1 1
Output
3.000000

Sample 2

Input
3 18
4 4 4 2 2 2
Output
18.000000
solution.py
Output appears here
Pouring Tea · Python Arena problem · LearnPy Hub