Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most a_{i} milliliters of water.

It turned out that among Pasha's friends there are exactly n boys and exactly n girls and all of them are going to come to the tea party. To please everyone, Pasha decided to pour the water for the tea as follows:  Pasha can boil the teapot exactly once by pouring there at most w milliliters of water;  Pasha pours the same amount of water to each girl;  Pasha pours the same amount of water to each boy;  if each girl gets x milliliters of water, then each boy gets 2x milliliters of water. 

In the other words, each boy should get two times more water than each girl does.

Pasha is very kind and polite, so he wants to maximize the total amount of the water that he pours to his friends. Your task is to help him and determine the optimum distribution of cups between Pasha's friends.


-----Input-----

The first line of the input contains two integers, n and w (1 ≤ n ≤ 10^5, 1 ≤ w ≤ 10^9) — the number of Pasha's friends that are boys (equal to the number of Pasha's friends that are girls) and the capacity of Pasha's teapot in milliliters.

The second line of the input contains the sequence of integers a_{i} (1 ≤ a_{i} ≤ 10^9, 1 ≤ i ≤ 2n) — the capacities of Pasha's tea cups in milliliters.


-----Output-----

Print a single real number — the maximum total amount of water in milliliters that Pasha can pour to his friends without violating the given conditions. Your answer will be considered correct if its absolute or relative error doesn't exceed 10^{ - 6}.


-----Examples-----
Input
2 4
1 1 1 1

Output
3
Input
3 18
4 4 4 2 2 2

Output
18
Input
1 5
2 3

Output
4.5


-----Note-----

Pasha also has candies that he is going to give to girls but that is another task...

Difficulty: MEDIUM
Tags: Mathematics

Sorting

Implementation

Constructive algorithms
Skill types: Sorting

Starter code:

Solutions:
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
max_per_cup = min(a[n] / 2, a[0])
print(min(max_per_cup * 3 * n, w))


(n, w) = map(int, input().split())
ls = list(map(int, input().split()))
ls.sort()
mi = min(ls[0], ls[n] / 2)
print(min(w, 3 * mi * n))


(n, w) = list(map(int, input().split()))
a = sorted(map(int, input().split()))
x = min(min(a[:n]), min(a[n:]) / 2)
print(min(w, 3 * n * x))


(n, w) = map(int, input().split())
l_t = list(map(int, input().split()))
l_t.sort()
t_a = min(w / (3 * n), l_t[0], l_t[n] / 2)
print(t_a * n * 3)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if 2 * a[0] <= a[n]:
	ans = min(3 * n * a[0], w)
else:
	ans = min(3 / 2 * n * a[n], w)
print(ans)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=False)
min_girl = a[0]
min_boy = a[n] * 0.5
if min_girl < min_boy:
	ans = min_girl * 3 * n * 1.0
else:
	ans = min_boy * 3 * n
ans = min(ans, w)
print('%.10f' % ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
print(3 * n * min(a[0], a[n] / 2, m / n / 3))


(n, w) = map(int, input().split())
ls = [int(a) for a in input().split()]
ls.sort()
mn = min(ls[0], ls[n] / 2)
print(min(mn * n * 3, w))


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
sorted_a = sorted(a)
minimum_girl_capacity_cup = sorted_a[0]
minimum_boy_capacity_cup = sorted_a[n]
minimum_girl_pouring = min(minimum_girl_capacity_cup, minimum_boy_capacity_cup / 2)
print(min(w, minimum_girl_pouring * 3 * n))


(n, w) = map(int, input().split())
a = sorted(map(int, input().split()))
(g, b) = (min(a[:n]), min(a[n:]))
v = [w]
if 2 * g <= b:
	v.append(n * 3 * g)
if b / 2 <= g:
	v.append(3 * n * b / 2)
print(min(v))


R = lambda : list(map(int, input().split()))
(n, w) = R()
a = R()
a.sort()
u = min(w / 3 / n, a[0], a[n] / 2)
print(u * 3 * n)


(n, w) = map(int, input().split())
a = sorted(list(map(int, input().split())))
if a[n] < a[0] * 2:
	s = 1.5 * a[n]
else:
	s = 3 * a[0]
print(min(s * n, w))


(n, w) = [int(i) for i in input().split()]
lst = sorted([int(j) for j in input().split()])
h = min(lst[0], lst[n] / 2, w / (3 * n))
print(3 * h * n)


(n, w) = [int(i) for i in input().split()]
capacity = [int(i) for i in input().split()]
capacity.sort(reverse=True)
result = 0
if capacity[n - 1] >= capacity[2 * n - 1] * 2:
	result = capacity[2 * n - 1] * 3 * n
else:
	result = capacity[n - 1] * 3 / 2 * n
if result <= w:
	print(result)
else:
	print(w)


R = lambda : list(map(int, input().split()))
(n, w) = R()
l = R()
l.sort()
M = l[n]
m = l[0]
if l[n] > 2 * l[0]:
	print(min(3 * m * n, w))
else:
	print(min(1.5 * M * n, w))


import sys
(n, w) = [int(i) for i in sys.stdin.readline().split()]
teacups = sorted([int(i) for i in sys.stdin.readline().split()])
(girl, boy) = [teacups[0], teacups[n]]
boy_ml = min(girl * 2, boy)
girl_ml = boy_ml / 2
total = min(n * (boy_ml + girl_ml), w)
print(total)


(n, w) = map(int, input().split())
a = sorted(map(int, input().split()))
x = a[0] * n * 3
y = a[n] * n * 1.5
print(min(w, x, y))


__author__ = 'myduomilia'
(n, volume) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
up_limit = min(arr[0], arr[n] / 2, volume / (3 * n))
print('%0.10f' % (up_limit * 3 * n))


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n, w) = I()
cups = I()
cups.sort()

def check(mid):
	girls = boys = 0
	ok = True
	ok &= cups[0] >= mid
	ok &= cups[n] >= 2 * mid
	return ok
(lo, hi) = (0, INF)
count = 0
while hi - lo > 10 ** (-6):
	count += 1
	if count == 10000:
		break
	mid = (lo + hi) / 2
	if check(mid):
		lo = mid
	else:
		hi = mid - 1e-07
print(min(lo, w / (3 * n)) * 3 * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
posi = a[n] / a[0]
if posi >= 2:
	x = a[0]
	res = n * x * 2 + n * x
else:
	x = a[n]
	res = n * x + n * x / 2
if res > w:
	res = w
print(res)


(n, w) = map(int, input().split())
cups = list(map(int, input().split()))
cups.sort()
m = min(cups[0], cups[n] / 2.0)
total = 3 * m * n
print(min(total, w))


import sys
(n, w) = [int(x) for x in input().split()[0:2]]
water = input()
water = [float(x) for x in water.split()]
water = sorted(water)
minNum = float(min(water[0], water[n] / 2))
result = minNum * 3 * n
if result > w:
	result = w
print(result)


(n, w) = map(int, input().split(' '))
c = input().split(' ')
c = [int(i) for i in c]
c.sort()
k = min(c[0], c[n] / 2) * 3 * n
print(min(k, w))


(n, cap) = map(int, input().split())
a = sorted(map(int, input().split()))
(g, b) = (a[0], a[n])
(left, right) = (0, g)
for _ in range(70):
	mid = (left + right) / 2
	if mid * 2 <= b:
		left = mid
	else:
		right = mid
(left, right) = (0, left)
for _ in range(70):
	mid = (left + right) / 2
	if mid * n + mid * 2 * n <= cap:
		left = mid
	else:
		right = mid
print(left * n + left * 2 * n)


inputt = input().split()
(n, w) = (int(inputt[0]), int(inputt[1]))
arr = [int(i) for i in input().split()]
arr.sort()
li = min(arr[0] * n * 3, arr[n] * n * 3 / 2)
li = min(li, w)
print(li)


(n, w) = [int(x) for x in input().split()]
caps = [int(x) for x in input().split()]
caps.sort()
g = caps[0]
b = caps[n]
if b < 2 * g:
	g = b / 2
print(min(g * 3 * n, w))


(n, w) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
a = arr[0]
b = arr[n]
if a * 2 > b:
	a = b / 2
else:
	b = 2 * a
print(min(w, a * n + b * n))


(number_of_boys, capacity) = map(int, input().split())
capacity_of_cups = list(map(int, input().split()))
capacity_of_cups.sort()
amount_of_girl = capacity_of_cups[0]
amount_of_boy = capacity_of_cups[number_of_boys]
pour = capacity / (3 * number_of_boys)
if amount_of_girl == amount_of_boy:
	amount_of_girl = amount_of_girl / 2
elif amount_of_girl * 2 > amount_of_boy:
	amount_of_girl = amount_of_boy / 2
if pour > amount_of_girl:
	pour = amount_of_girl
print(pour * 3 * number_of_boys)


(boy_count, amount_of_tea) = map(int, input().split())
cups = map(int, input().split())
cups = sorted(cups)
smallest_cup_girl = cups[0]
smallest_cup_boy = cups[boy_count]
tea_unit_needed = boy_count * 3
min_amount = min(float(smallest_cup_girl), smallest_cup_boy / 2)
min_amount = min(min_amount, amount_of_tea / (3 * boy_count))
total = min_amount * tea_unit_needed
print(total)


(n, w) = map(int, input().split())
ai = list(map(int, input().split()))
ai.sort()
if ai[n] > ai[0] * 2:
	ai[n] = ai[0] * 2
if ai[n] * 1.5 * n > w:
	print(w)
else:
	print(ai[n] * 1.5 * n)


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
a.sort(reverse=True)
b = a[:n]
g = a[n:]
portion = min(b[-1], g[-1] * 2)
s = portion * n + portion * n / 2
s = min(s, w)
print(s)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if 2 * a[0] <= a[n]:
	p = a[0]
else:
	p = a[n] / 2
if 3 * n * p <= w:
	result = 3 * n * p
else:
	result = w
print(result)


(n, w) = map(int, input().split())
array = []
for i in map(int, input().split()):
	array.append(i)
array.sort()
x = min(array[0], array[n] / 2)
upperBound = w / (3 * n)
if x > upperBound:
	x = upperBound
ans = 3 * n * x
print(ans)


(x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = x * 3
s = y / b
a.sort()
z = len(a) // 2
k = min(a[z:])
p = min(a[:z])
w = min(s, k / 2, p)
print(x * (w + 2 * w))


(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
v1 = a[0]
v2 = a[n]
q = min(v1, v2 / 2)
print(min(w, q * n * 3))


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
first = a[0]
second = a[n]
if first * 2 <= second:
	print(min(x, 3 * n * first))
else:
	print(min(x, 3 * n * second / 2))


(n, w) = map(int, input().split())
cups = list(map(int, input().split()))
cups.sort()
total_tea = 0
total_tea = min(cups[0], cups[n] / 2)
print(min(3 * total_tea * n, w))


(n, w) = map(int, input().split())
cups = list(map(int, input().split()))
cups.sort()
boys_min = cups[n]
girl_min = cups[0]
tea = girl_min
if boys_min < girl_min * 2:
	tea = boys_min / 2
if tea * 2 * n + tea * n > w:
	tea = w / (3 * n)
print(tea * 3 * n)


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
a.sort()
res = 0
if a[n] < a[0] * 2:
	res = 3.0 / 2 * a[n] * n
else:
	res = 3.0 * n * a[0]
if res > w:
	res = w
print('%.10f' % res)


(n, w) = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
print(min(a[0], a[n] / 2, w / (3 * n)) * 3 * n)


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
sorted_a = sorted(a)
amount = sorted_a[0]
minimum_boy_capacity_cup = sorted_a[n]
res = 0
if minimum_boy_capacity_cup / 2 <= amount:
	res = minimum_boy_capacity_cup * n + minimum_boy_capacity_cup / 2 * n
else:
	while amount >= 0:
		if amount * 2 > minimum_boy_capacity_cup:
			amount = amount / 2
		else:
			res = amount * n + amount * 2 * n
			break
print(min(w, res))


(n, w) = map(int, input().split())
a = sorted(list(map(int, input().split())))
h = min(a[0], a[n] / 2, w / (3 * n))
print(3 * h * n)


def pasha_and_tea(n, w, l):
	s = sorted(l)
	if s[n] >= s[0] * 2:
		girl = s[0]
		boy = s[0] * 2
	else:
		girl = s[n] / 2
		boy = s[n]
	if (girl + boy) * n <= w:
		print((girl + boy) * n)
	else:
		print(w)
(n, w) = list(map(int, input().split()))
l = list(map(int, input().split()))
pasha_and_tea(n, w, l)


import sys
([n, w], a) = (map(int, sys.stdin.readline().split()), sorted(map(int, sys.stdin.readline().split())))
print(min(w / 3 / n, a[n] / 2, a[0]) * 3 * n)


(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
bg = arr[0]
bb = arr[n]
c = min(min(float(bg), bb / 2), min(bg * 2, bb) / 2)
if c * 3 * n <= w:
	print(c * 3 * n)
else:
	print(w)


(n, w) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
t = min(a[0] * 2, a[len(a) // 2])
print(min(w, t * len(a) // 2 + t / 2 * (len(a) // 2)))


def answer(n, w, A):
	A.sort(reverse=True)
	maxb = A[n - 1]
	maxg = A[-1]
	if maxb <= 2 * maxg:
		maxg = maxb / 2
	return min(3 * n * maxg, w)
(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
print(answer(n, w, arr))


import unittest
import sys
import re

class Tea:

	def __init__(self, args):
		self.list = args[2]
		self.n = args[0]
		self.w = args[1]
		self.slist = sorted(self.list)
		self.b = self.slist[self.n]
		self.g = self.slist[0]
		self.wmax = self.n * min(self.b, self.g * 2) + self.n * min(self.b / 2, self.g)

	def calculate(self):
		result = min(self.wmax, self.w)
		return str(result)

def get_inputs(test_inputs=None):
	it = iter(test_inputs.split('\n')) if test_inputs else None

	def uinput():
		if it:
			return next(it)
		else:
			return input()
	nums = [int(s) for s in uinput().split()]
	cups = [int(s) for s in uinput().split()]
	inputs = nums
	inputs.append(cups)
	return inputs

def calculate(test_inputs=None):
	return Tea(get_inputs(test_inputs)).calculate()

class unitTests(unittest.TestCase):

	def test_sample_tests(self):
		test = '2 4\n1 1 1 1'
		self.assertEqual(calculate(test), '3.0')
		self.assertEqual(get_inputs(test), [2, 4, [1, 1, 1, 1]])
		test = '3 18\n4 4 4 2 2 2'
		self.assertEqual(calculate(test), '18.0')
		test = '1 5\n2 3'
		self.assertEqual(calculate(test), '4.5')
		test = '2 5\n1 2 3 4'
		self.assertEqual(calculate(test), '5')

	def test_Tea_class__basic_functions(self):
		d = Tea([2, 4, [1, 1, 2, 1]])
		self.assertEqual(d.list[0], 1)
		self.assertEqual(d.w, 4)
		self.assertEqual(d.n, 2)
		self.assertEqual(d.slist[-1], 2)
		self.assertEqual(d.b, 1)
		self.assertEqual(d.g, 1)
		self.assertEqual(d.wmax, 3)
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
print(calculate())


def main():
	(n, w) = map(int, input().split())
	capacity = list(map(int, input().split()))
	capacity.sort()
	girlCap = capacity[0]
	boyCap = capacity[n]
	if 2 * girlCap <= boyCap:
		Total = 3 * n * capacity[0]
	else:
		Total = 1.5 * n * capacity[n]
	if Total > w:
		Total = w
	print(Total)
main()


(n, w) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
l = len(a)
(i, j) = (0, int(l / 2))
while True:
	if a[i] > w:
		a[i] = w
	if a[j] > w:
		a[j] = w
	if a[i] * 2 <= a[j] and a[j] / 2.0 <= a[i]:
		print(min(max(a[i], a[j] / 2.0) * 3 * n, w))
		break
	elif a[i] * 2 <= a[j]:
		print(min(a[i] * 3 * n, w))
		break
	elif a[j] / 2.0 <= a[i]:
		print(min(a[j] / 2 * 3 * n, w))
		break
	j += 1


[n, w] = list(map(int, input().split()))
arr = list(map(int, input().split()))
tmpArr = list(reversed(sorted(arr)))
x = min(tmpArr[n - 1] / 2, tmpArr[-1])
print(min(3 * x * n, w))


def inp():
	return map(int, input().split())
(n, w) = inp()
a = list(inp())
a.sort()
girls = a[:n]
boys = a[n:]
x = 0
if girls[0] * 2 > boys[0]:
	x = boys[0] / 2
else:
	x = girls[0]
total = 3 * x * n
if total > w:
	total = w
print(total)


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
a.sort()
mingirl = a[0]
minboy = a[n]
wgirl = w / 3
wboy = w - wgirl
if mingirl * 2 <= minboy:
	m = mingirl
else:
	m = minboy / 2
q = min(m * n * 3, w)
print(q)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	(n, w) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	(alpha, omega) = (0, w / (3 * n))
	lastmid = -1
	while alpha < omega:
		mid = (alpha + omega) / 2
		if mid == lastmid:
			break
		lastmid = mid
		if a[0] >= mid and a[n] >= 2 * mid:
			alpha = mid
		else:
			omega = mid - 10 ** (-17)
	print(omega * 3 * n)


(boy_count, amount_of_tea) = map(int, input().split())
cups = map(int, input().split())
cups = sorted(cups)
smallest_cup_girl = cups[0]
smallest_cup_boy = cups[boy_count]
tea_unit_needed = boy_count * 2 + boy_count
min_amount = min(float(smallest_cup_girl), smallest_cup_boy / 2)
total = min_amount * tea_unit_needed
if amount_of_tea < total:
	min_amount = amount_of_tea / tea_unit_needed
total = min_amount * tea_unit_needed
while total > amount_of_tea:
	total = min_amount * tea_unit_needed
	temp = total - amount_of_tea
	min_amount -= temp
print(total)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if a[n] / a[0] >= 2:
	x = a[0]
else:
	x = a[n] / 2
sum = 3 * n * x
print(min(sum, w))


def inp():
	return map(int, input().split(' '))
(n, w) = inp()
v = inp()
v = sorted(v)
if v[n] * 1.0 / v[0] >= 2.0:
	x = v[0]
else:
	x = v[n] * 1.0 / 2.0
sum = 3.0 * n * x
if sum > w:
	sum = w
print(sum)


def init():
	num_input = input()
	num_input = num_input.split(' ')
	n = int(num_input[0])
	w = int(num_input[1])
	a = input()
	a = a.split(' ')
	length = 2 * n
	for i in range(length):
		a[i] = int(a[i])
	return (a, n, w)

def solve(a, n, w):
	a.sort()
	cup = min(a[0], a[n] / 2)
	return min(3 * n * cup, w)
(a, n, w) = init()
print(solve(a, n, w))


(n, w) = map(int, input().split())
a = [x for x in list(map(int, input().strip().split()))]
a.sort()
c = a[len(a) // 2] * n
d = a[0] * n
q = w / 3
if q < d and 2 * q < c or (abs(q - d) < 0.001 and abs(q * 2 - c) < 0.001):
	print(w)
elif 2 * d > c:
	print(c + c / 2)
elif 2 * d < c:
	print(d + d * 2)
elif abs(c - d * 2) < 0.001:
	print(d + d * 2)


(n, w) = [int(c) for c in input().split()]
a = [int(c) for c in input().split()]
a.sort()
maxgirl = w / (3 * n)
for i in range(n):
	if a[i] < maxgirl:
		maxgirl = a[i]
for i in range(n, 2 * n):
	if a[i] < 2 * maxgirl:
		maxgirl = a[i] / 2
print(maxgirl * 3 * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
temp = sorted(a)
m = min(temp[0], temp[n] / 2)
total = 3 * m * n
print(min(total, w))


(n, w) = map(int, input().split(' '))
arr = input().split(' ')
for i in range(2 * n):
	arr[i] = int(arr[i])
arr.sort()
boysize = arr[n]
girlsize = arr[0]
x = min(boysize / 2, girlsize)
print(min(w, 3 * x * n))


(n, w) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
b = []
g = []
for i in range(n):
	g.append(l[i])
i = n
while i < 2 * n:
	b.append(l[i])
	i += 1
low = 0
high = w
itr = 200
m = 0
while itr:
	mid = (low + high) / 2
	k = w
	f = 0
	for i in range(n):
		o = g[i]
		t = b[i]
		if o >= mid and t >= 2 * mid:
			k = k - (2 * mid + mid)
		else:
			f = 1
			break
	if k < 0:
		high = mid
		itr -= 1
		continue
	if f == 1:
		high = mid
		itr -= 1
		continue
	if m < mid:
		m = mid
	low = mid
	itr -= 1
ans = 0
for i in range(n):
	ans = ans + m + 2 * m
print(ans)


(n, w) = map(int, input().split())
a = [float(x) for x in input().split()]
a.sort()
tt = min(a[0], a[n] / 2)
ttt = 3 * n * tt
t = w
t = min(w, 3 * n * tt)
print(t)


import sys
(n, w) = map(int, input().split())
Array = list(map(int, input().split()))
Array = sorted(Array)
x = min(Array[0], Array[n] / 2)
result = n * x + 2 * x * n
if result > w:
	print(w)
	sys.exit(0)
print(result)


def main():
	(n, w) = map(int, input().split())
	a = list(sorted(map(int, input().split())))
	q = min(min(a[:n]), min(a[n:]) / 2)
	print(min(q * 3 * n, w))
main()


(n, w) = map(int, input().split())
capac = list(sorted(map(int, input().split())))
boy = capac[len(capac) // 2]
girl = capac[0]
print(min(3 * girl * n, 3 / 2 * boy * n, w))


withFile = 0
if withFile == 1:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')

def getl():
	if withFile == 0:
		return input()
	else:
		return fin.readline()

def printl(s):
	if withFile == 0:
		print(s)
	else:
		fout.write(str(s))

def get_arr():
	x = getl().split(' ')
	if x[-1] == '':
		x = x[:-1]
	return list(map(int, x))
a = get_arr()
(n, w) = (a[0], a[1])
a = get_arr()
a = sorted(a)
min1 = w / (n * 3)
min2 = min(a[:n])
min3 = min(a[n:]) / 2
mina = min(min1, min2, min3)
print(mina * 3 * n)
if withFile == 1:
	fin.close()
	fout.close()


def main():
	(n, w) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	a = sorted(a)
	x = w / (3 * n)
	if x <= a[0] and 2 * x <= a[n]:
		print(w)
	else:
		print(3 * min(a[0], a[n] / 2) * n)
main()


(n, w) = input().split()
n = int(n)
w = int(w)
a = [0] * (2 * n)
a = input().split()
for i in range(2 * n):
	a[i] = int(a[i])
a.sort()
print(min(a[0], a[n] / 2, w / 3 / n) * 3 * n)


I = lambda : map(int, input().split())
(n, w) = I()
a = sorted(I())
t = min(a[0] * 2, a[n])
print(min(t * n * 3 / 2, w))


(n, w) = map(int, input().split())
capa = list(map(int, input().split()))
sorted = sorted(capa, reverse=True)
x = min(sorted[n - 1] / 2, sorted[-1], w / (3 * n))
resultW = 3 * n * x
print(resultW)


friends_and_teapotsize = list(map(int, list(input().split())))
cup_size = list(map(int, list(input().split())))
total_boys = friends_and_teapotsize[0]
total_teapot = friends_and_teapotsize[1]
cup_size.sort(reverse=False)
smallest_girl_cup = cup_size[0]
smallest_boy_cup = cup_size[total_boys]
tea_per_girl = 0
if smallest_girl_cup * 2 < smallest_boy_cup:
	smallest_boy_cup = smallest_girl_cup * 2
if smallest_girl_cup * 2 > smallest_boy_cup:
	smallest_girl_cup = smallest_boy_cup / 2
max_tea_per_girl = total_teapot / (3 * total_boys)
if max_tea_per_girl > smallest_girl_cup:
	max_tea_per_girl = smallest_girl_cup
if max_tea_per_girl > smallest_boy_cup / 2:
	max_tea_per_girl = smallest_boy_cup / 2
result = max_tea_per_girl * total_boys * 3
print(result)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if a[0] >= a[n] / 2:
	m = a[n] * n + a[n] * n / 2
else:
	m = a[0] * n + a[0] * n * 2
if m > w:
	print(w)
else:
	print(m)


inp = lambda : map(int, input().split())
(n, w) = inp()
a = sorted([*inp()])
print(min(w, min(a[n] / 2, a[0]) * n * 3))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict, deque

def VI():
	return list(map(int, input().split()))

def I():
	return int(input())

def LIST(n, m=None):
	return [0] * n if m is None else [[0] * m for i in range(n)]

def ELIST(n):
	return [[] for i in range(n)]

def MI(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = VI()
	return arr

def MS(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = input()
	return arr

def MIT(n=None, m=None):
	if n is None:
		(n, m) = VI()
	a = MI(n, m)
	arr = LIST(m, n)
	for (i, l) in enumerate(a):
		for (j, x) in enumerate(l):
			arr[j][i] = x
	return arr

def run(n, x, l, r):
	s = 0
	curr = 1
	for i in range(n):
		skip = (l[i] - curr) // x
		s += r[i] - curr - skip * x + 1
		curr = r[i] + 1
	print(s)

def main(info=0):
	(n, w) = VI()
	a = sorted(VI())
	x = min(min(a[:n]), min(a[n:]) / 2)
	print(min(w, x * n + x * n * 2))
main()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
minel = min(a)
a.sort()
a = a[n:]
boys = 0
girls = 0
if minel * 2 > min(a):
	girls = min(a) / 2
	boys = min(a)
else:
	boys = minel * 2
	girls = minel
if boys * n + girls * n > w:
	print(w)
else:
	print(boys * n + girls * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(a)
b1 = b[0:n]
b2 = b[n:2 * n]
maxGirl = b1[0]
maxBoy = b2[0]
maxWater = w / 3 / n
maxCapity = 0
total = 0
if maxGirl * 2 > maxBoy:
	maxCapity = maxBoy / 2
else:
	maxCapity = maxGirl
if maxWater > maxCapity:
	total = maxCapity * n * 3
else:
	total = maxWater * n * 3
print(total)


(n, w) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
x = v[n] / v[0]
if x >= 2:
	x = v[0]
else:
	x = v[n] / 2
sum = x * n + x * n * 2
if sum > w:
	sum = w
print(sum)


(n, w) = map(int, input().split())
t1 = w / (3 * n)
a = list(map(int, input().split()))
a.sort()
a1 = a[n]
a2 = a[0]
if a1 / 2 <= a2:
	t = a1 / 2
else:
	t = a2
if t < t1:
	print(3 * n * t)
else:
	print(w)


__author__ = 'Данила'
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
a.sort()
ans = min(3 * n * a[0], 3 * n * a[n] / 2, w)
print(ans)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
girl = a[:n]
boy = a[n:]
minG = min(girl)
minB = min(boy)
x = min(minG, minB / 2, w / (3 * n))
ans = 3 * x * n
if ans - int(ans) == 0:
	print(int(ans))
else:
	print(ans)


k = list(map(int, input().split()))
n = k[0]
w = k[1]
a = list(map(int, input().split()))
sort = sorted(a)
boy = sort[n]
girl = sort[0]
x = 0
if boy / 2 >= girl:
	x = girl
if girl * 2 >= boy:
	x = boy / 2
total = 3 * x * n
if total > w:
	print(w)
elif total - int(total) == 0:
	print(int(total))
else:
	print(total)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
S = sorted(l)
v = S[0]
g = S[n]
l1 = v * n + g * n
if l1 - m < 0:
	m = l1
p = m / 3
p1 = p * 2
t = p / n
t1 = p1 / n
if t1 > g:
	t1 = g
	t = t1 / 2
if t > v:
	t = v
	t1 = v * 2
print((t + t1) * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
G = a[-1]
B = a[n - 1]
if B >= 2 * G:
	print(min(w, 3 * G * n))
else:
	G = B / 2
	print(min(w, 3 * G * n))


(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
maxx = w / (3 * n)
t = 0
if a[n] / 2 > a[0]:
	t = a[0]
else:
	t = a[n] / 2
if t > maxx:
	print(w)
else:
	print(t * 3 * n)


first_line = list(map(int, input().split()))
n = first_line[0]
w = first_line[1]
a = list(map(int, input().split()))
a.sort()
used = 0
if a[0] > a[n] / 2:
	used = a[n] / 2 * n + a[n] * n
	print(min(used, w))
else:
	used = a[0] * n + a[0] * 2 * n
	print(min(w, used))


(n, w) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
l = len(a)
(i, j) = (0, int(l / 2))
if a[i] * 2 <= a[j] and a[j] / 2.0 <= a[i]:
	print(min(max(a[i], a[j] / 2.0) * 3 * n, w))
elif a[i] * 2 <= a[j]:
	print(min(a[i] * 3 * n, w))
elif a[j] / 2.0 <= a[i]:
	print(min(a[j] / 2 * 3 * n, w))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
g = []
b = []
m = 0
cnt = 0
v = 0
minb = a[n]
ming = a[0]
for i in range(len(a)):
	g.append(a[i])
	cnt += 1
	if cnt == n:
		break
for j in range(n, len(a), 1):
	b.append(a[j])
	cnt += 1
	if cnt == n:
		break
if minb / 2 <= ming:
	m = minb / 2
else:
	m = ming
res = m * n + m * 2 * n
if res < w:
	print(res)
else:
	print(w)


(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
maxGirl = arr[n] / 2
x = min(maxGirl, arr[0])
total = (n + 2 * n) * x
if total <= w:
	print(total)
else:
	print(w)


(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
arr.reverse()
(boys, girls) = (arr[:n], arr[n:n * 2])
if min(boys) / 2 >= min(girls):
	print(min(min(girls) * n + min(girls) * n * 2, w))
else:
	print(min(min(boys) * n + min(boys) * n / 2, w))


(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = a[n]
g = a[0]
if b >= 2 * g:
	ret = g * 2 * n + g * n
elif b >= g:
	ret = b * n + float(b) / 2 * n
print(min(ret, w))


(n, w) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
c = w / 3 / n
a.sort()
if a[0] > c and a[n] > 2 * c:
	print(w)
else:
	print(min(a[n] / 2, a[0]) * 3 * n)


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(number_of_variables):
	if number_of_variables == 1:
		return int(sys.stdin.readline())
	if number_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
mod = 100000007
(n, w) = vary(2)
num = array_int()
num.sort()
print(min(w, 3 * n * num[0], 1.5 * n * num[n]))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
g = a[0]
b = a[n]
if g * 2 <= b:
	b = g * 2
elif g * 2 > b:
	g = b / 2
ans = g * n + b * n
if ans > w:
	ans = w
print(ans)


(n, w) = [int(i) for i in input().split()]
capacity = [int(i) for i in input().split()]
capacity.sort(reverse=True)
result = min(capacity[2 * n - 1] * 3 * n, capacity[n - 1] * 3 / 2 * n, w)
print(result)


(n, w) = [int(x) for x in input().split(' ')]
L = [int(x) for x in input().split(' ')]
L.sort()
x = L[0]
y = L[n]
if 2 * x > y:
	t = y / 2
else:
	t = x
t = t * 3 * n
if t > w:
	t = w
print(t)


(n, w) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
l = sorted(l)
if l[0] * 2 >= l[int(len(l) / 2)]:
	if l[int(len(l) / 2)] >= w / 3 * 2 / n:
		print(w)
	else:
		print(l[int(len(l) / 2)] / 2 * n + l[int(len(l) / 2)] * n)
else:
	v = w / 3
	if l[0] >= v / n:
		print(w)
	else:
		print(l[0] * 3 * n)


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return sorted(fac)

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def good(mid, w, girls, boys):
	for i in range(0, len(girls)):
		if girls[i] < mid:
			return False
	for i in range(0, len(boys)):
		if boys[i] < 2 * mid:
			return False
	return True
(n, w) = map(int, input().split())
a = sorted(list(map(int, input().split())))
girls = []
boys = []
for i in range(0, n):
	girls.append(a[i])
for i in range(n, len(a)):
	boys.append(a[i])
l = 0
r = w
ans = 0
for i in range(65):
	mid = (l + r) / 2
	if good(mid, w, girls, boys) == True:
		l = mid
		ans = mid
	else:
		r = mid
fans = 0
for i in range(0, len(girls)):
	fans += ans
for i in range(0, len(boys)):
	fans += ans * 2
print(min(fans, w))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
girls = a[:n]
boys = a[n:]
x = 0
x = min(girls[0], boys[0] / 2)
total = 3 * x * n
print(min(total, w))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = min(a[0], a[n] / 2)
res = min(3 * x * n, w)
print(res)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cap = min(a[0], a[n] / 2)
serve = min(w / n / 3, cap)
ans = serve * 3 * n
print(ans)


(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
boy = arr[n]
girl = arr[0]
if girl * 2 < boy:
	boy = girl * 2
elif girl * 2 > boy:
	girl = boy / 2
print(min(n * (girl + boy), w))


tmp = input().split()
n = int(tmp[0])
w = int(tmp[1])
arr = []
tmp = input().split()
for i in tmp:
	arr.append(int(i))
arr.sort()
if arr[n] / 2 <= arr[0] and arr[n] / 2 * 3 * n <= w:
	print('%.7f' % (arr[n] / 2 * 3 * n))
elif arr[0] * 3 * n <= w:
	print('%.7f' % (arr[0] * 3 * n))
else:
	print(w)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
(n, w) = MAP()
arr = LIST()
arr.sort()
(min_girl, min_boy) = (arr[0], arr[n])
if 2 * min_girl > min_boy:
	min_girl = min_boy / 2
elif 2 * min_girl < min_boy:
	min_boy = 2 * min_girl
res = min(w, (min_girl + min_boy) * n)
print(res)


l = [int(x) for x in input().split(' ')]
(n, w) = l[:]
l = [int(x) for x in input().split(' ')]
l.sort()
girls = l[:n]
boys = l[n:]
mg = girls[0]
mb = boys[0]
q1 = w / (3 * n)
q2 = mb / 2
q3 = mg
x = min(q1, min(q2, q3))
print(x * 3 * n)


(n, w) = map(int, input().split())
a = sorted(map(int, input().split()))
print(min(w, min(a[0], a[n] * 0.5) * 3 * n))


(n, w) = input().split()
n = int(n)
w = int(w)
k = input().split()
k = [int(x) for x in k]
x = float(w) / float(3 * n)
k.sort()
if k[0] < x:
	x = k[0]
if k[n] < 2 * x:
	x = float(k[n] / 2)
ans = float(3 * n * x)
print(ans)


(n, w) = map(int, input().split())
read = list(map(int, input().split()))
read.sort(reverse=True)
c = min(read[-1], read[n - 1] / 2)
print(min(w, c * 3 * n))


(a, k) = map(int, input().split())
l = sorted(map(int, input().split()))
print(min(k, a * (3 * min(l[a] / 2.0, l[0]))))


(n, w) = list(map(int, input().split()))
cups = sorted(list(map(int, input().split())))
girl_cap = min(cups[0], cups[n] / 2)
print(min(girl_cap * 3 * n, w))


(N, W) = tuple(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
A.sort()
smallest_girl = A[0]
smallest_boy = A[N]
smallest_girl = min(smallest_girl, smallest_boy / 2)
smallest_boy = min(smallest_boy, smallest_girl * 2)
max_pour = (smallest_boy + smallest_girl) * N
print(min(W, max_pour))


def f():
	[n, w] = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	a.sort()
	print(format(min(min(a[0], a[n] / 2) * 3 * n, w), '.20f'))
f()


(n, w) = map(int, input().split())
read = list(map(int, input().split()))
read.sort(reverse=True)
a = []
b = []
for i in range(n):
	a.append(read[i])
	b.append(read[i + n])
c = []
for i in range(n):
	c.append(min(a[i] / 2, b[i]))
print(min(w, min(c) * 3 * n))


l2 = input().split()
n = int(l2[0])
w = int(l2[1])
l = map(int, input().split())
l = sorted(l, reverse=True)
minB = 2000000000
minG = 2000000000
for i in range(n):
	minB = min(minB, l[i])
	minG = min(minB, l[i + n])
x = min(minB / 2, minG)
print(min(w, n * x * 3))


(n, w) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
g = l[0]
b = l[n]
ans = min(b / 2.0, g)
ans = min(ans * 3.0 * n, w)
print(ans)


s = input()
(n, w) = map(int, s.split())
s = input()
sizes = list(map(int, s.split()))
sizes.sort()
x = min(sizes[0], sizes[n] / 2)
ans = 3 * n * x
if ans > w:
	print(w)
else:
	print(ans)


from collections import Counter, defaultdict, deque
from operator import itemgetter
import math
import sys
input = sys.stdin.readline

def solve():
	(n, w) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	arr.sort()
	g = arr[0]
	b = arr[n]
	left = 0
	right = w
	for i in range(1000):
		mid = (left + right) / 2
		if mid <= g and 3 * n * mid < w and (b >= 2 * mid):
			left = mid
		else:
			right = mid
	print(min(w, 3 * mid * n))
tt = 1
for test in range(tt):
	solve()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
print(min(w, min(a[0], a[n] * 0.5) * 3 * n))


def sinput():
	s = input().split()
	return (int(s[0]), int(s[1]))
(n, w) = sinput()
s = input().split()
s = [int(i) for i in s]
s.sort()
print(min(s[0] * 3 * n, s[n] * 3 / 2 * n, w))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
w_limit = w / n
(b_min, b_max) = (a[n], a[-1])
(g_min, g_max) = (a[0], a[n - 1])
x = 0
if g_min * 2 <= b_min:
	x = g_min
else:
	x = b_min / 2
r = 3 * x * n
print(r if w >= r else w)


(n, m) = map(int, input().split())
c = list(sorted(map(int, input().split())))
print(min(min(c[:n]) * n * 3, min(c[n:2 * n]) / 2 * n * 3, m))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
mina = a[n]
maxa = a[0]
ans = min(mina / 2.0, maxa)
ans = 3.0 * n * ans
ans = min(ans, w * 1.0)
print(ans)


(n, m) = map(int, input().split())
min1 = 1000000000000
min2 = 1000000000000
ar = list(map(int, input().split()))
ar = list(sorted(ar))
for i in range(n):
	min1 = min(min1, ar[i])
for i in range(n, 2 * n):
	min2 = min(min2, ar[i])
if min1 * 2 <= min2:
	ans = min1 * 3
else:
	ans = min2 + min2 / 2
print(min(ans * n, m))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
lo = min(a)
hi = a[n]
ref = min(2 * lo, hi)
total = n * ref + n * ref / 2
print(min(total, w))


s = [int(x) for x in input().split(' ')]
(n, pot) = (s[0], s[1])
cups = sorted([int(x) for x in input().split(' ')])[::-1]
for i in range(0, len(cups) // 2):
	cups[i] = cups[i] / 2
l = len(cups)
min_cup = min(cups)
y = min_cup * n * 3
print(y if y < pot else pot)


INPUT = lambda : map(int, input().split())
(n, w) = INPUT()
a = sorted(INPUT())
print(min(w, 1.5 * n * a[n], 3 * n * a[0]))


(n, w) = map(int, input().split(' '))
mas = list(map(int, input().split(' ')))
mas.sort()
x1 = w / n / 3
x2 = mas[0]
x3 = mas[n] / 2
print(3 * n * min(x1, x2, x3))


(n, w) = map(int, input().split())
A = list(map(int, input().split()))
x = w / (3 * n)
A = sorted(A, reverse=True)
cup_max = A[len(A) // 2 - 1]
cup_min = A[-1]
if 2 * x > cup_max:
	cup_min = cup_max / 2
else:
	cup_max = 2 * x
	cup_min = x
if A[-1] < cup_min:
	cup_min = A[-1]
	cup_max = cup_min * 2
tea = n * cup_min + n * cup_max
print(tea)


(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
a.sort()
b = a[n]
g = a[0]
res = g * n * 3
if res > b / 2 * n * 3:
	res = b / 2 * n * 3
if res > w:
	res = w
print(res)


(n, w) = (int(i) for i in input().split())
tea = sorted((int(i) for i in input().split()))
smallest = min(tea[0], tea[n] / 2)
print(min(smallest * 3 * n, w))


def getMaxlWater(n, w, a):
	a.sort()
	minCup = min(a[0], a[n] / 2)
	if minCup * 3 * n > w:
		print(w)
		exit()
	return minCup * 3 * n
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
result = getMaxlWater(n, w, a)
if result % 1 != 0:
	print(result)
else:
	print(int(result))


(n, w) = map(int, input().split())
teas = list(map(int, input().split()))
teas.sort()
x = min(teas[0], teas[n] / 2)
x = min(x, w / (3 * n))
print(3 * x * n)


(n, w) = map(int, input().split())
l = sorted(map(int, input().split()))
print(min(w, l[n] * n * 1.5, l[0] * n * 3))


(n, w) = map(int, input().split())
n *= 2
arr = list(map(int, input().split()))
arr.sort()
g = arr[:n // 2]
b = arr[n // 2:]
first_g = g[0]
first_b = b[0]
if first_g * 2 > first_b:
	first_g = first_b / 2
elif first_g * 2 < first_b:
	first_b = first_g * 2
ans = first_g * n / 2 + first_b * n / 2
print(min(ans, w))


(n, w) = map(int, input().split(' '))
v = list(map(int, input().split(' ')))
v = sorted(v)
if v[n] / v[0] >= 2:
	x = v[0]
else:
	x = v[n] / 2
sum = 3 * n * x
if sum > w:
	sum = w
print(sum)


(n, w) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
l.sort()
print(min(w, 3 * n * min(l[0], l[n] / 2)))


(n, w, *vl) = list(map(int, input().split(' '))) + list(map(int, input().split(' ')))
vl.sort()
print(3 * n * min(vl[n] / 2, vl[0], w / (3 * n)))


__author__ = 'artyom'

def main():
	(n, w) = read(3)
	a = sorted(read(3))
	r = min(a[0], a[n] / 2, w / (3 * n))
	return 3 * r * n

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


(n, w) = map(int, input().split())
cups = [int(i) for i in input().split()]
cups.sort()
if cups[n] >= cups[0] * 2:
	water = cups[0] * 3 * n
	if water > w:
		print(w)
		quit()
	else:
		print(water)
		quit()
else:
	water = cups[n] * 3 / 2 * n
	if water > w:
		print(w)
		quit()
	else:
		print(water)
		quit()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
g = a[0]
b = a[n] / 2
maxm = w / (3 * n)
print(min(g, b, maxm) * 3 * n)


inp = input().split()
n = int(inp[0])
w = int(inp[1])
cups = sorted(list(map(int, input().split())))
girl = cups[0]
boy = cups[n]
s = 0
s += min(girl, boy / 2) * 3 * n
print(min(s, w))


(n, w) = list(map(int, input().split(' ')))
cups = list(map(int, input().split(' ')))
cups.sort()
max_girl = cups[0]
max_boy = cups[n]
x = min(max_girl, max_boy / 2.0, w / (3.0 * n))
print(3 * x * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
t = min(a[0], a[n] / 2)
ans = min(3 * t * n, w)
print(ans)


import math
import itertools
import os
import sys
(n, w) = map(int, input().split())
A = map(int, input().split())
A = sorted(A)
minv = min(min(A[:n]), min(A[n:]) / 2)
(l, r) = (0, w)
while r - l > 1e-06:
	m = l + (r - l) / 2
	x = m / (3 * n)
	if x > minv:
		r = m
	else:
		l = m
print('%.7f' % l)


(n, w) = list(map(int, input().split()))
teapots = list(map(int, input().split()))
sorted_teapots = sorted(teapots)
min_teapot_women = sorted_teapots[0]
min_teapot_man = sorted_teapots[n] / 2
max_w = min(3 * n * min(min_teapot_women, min_teapot_man), w)
print(max_w)


__author__ = 'Andrey'
(n, w) = map(int, input().split())
volumes = list(map(int, input().split()))
volumes.sort()
m = -1
if volumes[0] * 2 <= volumes[n]:
	possible = 3 * n * volumes[0]
	if possible <= w:
		m = max(m, possible)
if volumes[n] / 2 <= volumes[0]:
	possible = volumes[n] / 2 * 3 * n
	if possible <= w:
		m = max(m, possible)
if w / (3 * n) <= volumes[0] and 2 * w / (3 * n) <= volumes[n]:
	m = max(m, w)
print(m)


R = lambda : list(map(int, input().split()))
(n, w) = R()
a = R()
a = sorted(a)
print(min(w, min(a[n] / 2, a[0]) * 3 * n))


(n, w) = map(int, input().split())
cap = list(map(int, input().split()))
cap.sort()
(girl_min, boy_min) = (cap[0], cap[n])
if girl_min * 2 <= boy_min:
	print(min(w, girl_min * 3 * n))
else:
	print(min(w, boy_min * 1.5 * n))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
g = a[0] * n + a[0] * 2 * n
b = a[n] * n + a[n] / 2 * n
if g > res and g <= w and (a[0] * 2 <= a[n]):
	res = g
elif b > res and b <= w and (a[n] // 2 <= a[0]):
	res = b
else:
	res = w
print('{:.8f}'.format(res))


def main():
	(n, w) = [int(t) for t in input().split()]
	a = sorted((int(t) for t in input().split()))
	min_girl_cup = a[0]
	min_boy_cup = a[n]
	max_girl_amount = min(min_girl_cup, min_boy_cup / 2)
	total = min(3 * max_girl_amount * n, w)
	print(total)
main()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
i = 0
j = len(a) - 1
total = 0
a.sort()
smallest = min(a[n] / 2, a[i])
if w <= smallest:
	total = w
else:
	while i < n:
		if total + smallest * 3 <= w:
			total += smallest * 3
		else:
			total = w
		i += 1
print(total)


(n, w) = map(int, input().split())
a = input().split()
for i in range(2 * n):
	a[i] = int(a[i])
a.sort()
g = []
b = []
for i in range(2 * n):
	if i < n:
		g.append(a[i])
	else:
		b.append(a[i] / 2)
print(min(3 * n * min(min(g), min(b)), w))


values = input().split()
n = int(values[0])
w = int(values[1])
cups = input().split()
for i in range(2 * n):
	cups[i] = int(cups[i])
cups.sort()
lowgirl = cups[0]
lowboy = cups[len(cups) // 2]
totalused = 0
if 2 * lowgirl <= lowboy:
	totalused = n * lowgirl + n * lowgirl * 2
else:
	totalused = n * (lowboy / 2) + n * lowboy
if totalused < w:
	print(totalused)
else:
	print(w)


nm = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
arr.sort()
print(min(nm[1] / 1, 3 * nm[0] * min(arr[0] / 1, arr[nm[0]] / 2)))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = a[n]
g = min(b / 2, a[0])
z = 3 * n * g
print(z if z <= w else w)


s = list(map(int, input().split(' ')))
n = s[0]
w = s[1]
s = list(map(int, input().split(' ')))
s.sort()
c1 = s[0]
c2 = s[n]
tmp = round(w / (n * 3), 6)
if c2 / 2 > c1:
	if tmp > c1:
		print(c1 * 3 * n)
	else:
		print(w)
elif tmp > c2 / 2:
	print(3 * n * c2 / 2)
else:
	print(w)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
import bisect
from collections import Counter
import bisect
from collections import deque
import bisect

def can(x):
	val = bisect.bisect_left(arr, 2 * x)
	val2 = bisect.bisect_left(arr, x)
	if 2 * n - val >= n and 2 * n - val2 >= 2 * n:
		return True
	return False
for _ in range(1):
	(n, m) = map(int, input().split())
	arr = sorted(list(map(int, input().split())))
	print(min(3 * n * arr[0], arr[n] * 1.5 * n, m))


__author__ = 'darinflar'
(n, w) = map(int, input().split())
l = [int(i) for i in input().split()]
l.sort()
d = w
for i in range(n):
	d = min(d, l[i])
m = w
for i in range(n, 2 * n):
	m = min(m, l[i])
xd = min(d, w / (3 * n))
xm = min(m, 2 * w / (3 * n))
x = min(xd, xm / 2)
x = 3 * x * n
print(x)


def main():
	(n, w) = list(map(int, input().split()))
	a = sorted(map(int, input().split()))
	print(min(w, min(a[0], a[n] * 0.5) * 3 * n))

def __starting_point():
	main()
__starting_point()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
minGirl = a[0]
minBoy = a[n]
x = min(minGirl, minBoy / 2)
print(min(w, 3 * x * n))


def maximum_boiling(n, w, a):
	a.sort()
	girl_cup = a[0]
	boy_cup = a[n]
	if boy_cup >= girl_cup * 2:
		return min(w, girl_cup * 3 * n)
	else:
		return min(w, boy_cup * 1.5 * n)

def read_input():
	(n, w) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	return (n, w, a)

def main():
	(n, w, a) = read_input()
	print(maximum_boiling(n, w, a))
main()


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = float(min(a[0], a[n] / 2))
sum = 3 * x * n
print('{0:.7f}'.format(min(sum, w)))


p = input().split()
n = int(p[0])
w = int(p[1])
q = input().split()
a = []
s = 0
for i in range(2 * n):
	a.append(int(q[i]))
a.sort()
if a[n] >= 2 * a[0]:
	s = n * a[0] + n * 2 * a[0]
else:
	s = n * a[n] + n * (a[n] / 2)
if s > w:
	print(w)
else:
	print(s)


(n, w) = map(int, input().split())
cups = [int(cup) for cup in input().split()]
cups.sort()
girl_cup = cups[0]
boy_cup = -1
for i in range(1, n + 1):
	boy_cup = cups[i]
	if boy_cup >= girl_cup * 2:
		break
if boy_cup < girl_cup * 2:
	result = (boy_cup + boy_cup / 2) * n
elif boy_cup > girl_cup * 2:
	result = (girl_cup * 2 + girl_cup) * n
else:
	result = (boy_cup + girl_cup) * n
if result <= int(result):
	result = int(result)
if result > w:
	result = w
print(result)


from sys import stdin
from sys import exit
live = True
if not live:
	stdin = open('data.in', 'r')
(n, w) = list(map(int, stdin.readline().strip().split()))
cups = list(map(int, stdin.readline().strip().split()))
maxx = w / (3 * n)
cups = sorted(cups, reverse=True)
for it in range(n):
	maxx = min(maxx, cups[it] / 2)
for it in range(n, 2 * n):
	maxx = min(maxx, cups[it])
print(3 * n * maxx)
if not live:
	stdin.close()


(n, w) = map(int, input().split())
a = sorted(map(float, input().split()))
print(min(a[0], a[n] / 2, w / 3 / n) * 3 * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
can_pour_g = w / (3 * n)
a = sorted(a)[::-1]
b = a[:n]
g = a[n:]
mb = min(b)
mg = min(g)
pg = 0
if mb > mg * 2:
	pg = mg
else:
	pg = mb / 2
if can_pour_g < pg:
	print(n * can_pour_g + 2 * n * can_pour_g)
else:
	print(n * pg + 2 * n * pg)


(n, w) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
res = 0
x_min = 0
if arr[0] * 2 <= arr[n]:
	x_min = float(arr[0])
else:
	x_min = float(arr[n] / 2)
if x_min * 3 * n <= w:
	res = float(x_min * 3 * n)
else:
	res = float(w)
if res % 1 != 0.0:
	print(res)
else:
	print(int(res))


import sys
([n, w], a) = (map(int, input().split()), sorted(map(int, input().split())))
print(min(w / 3 / n, a[n] / 2, a[0]) * 3 * n)


class CodeforcesTask557BSolution:

	def __init__(self):
		self.result = ''
		self.n_w = []
		self.cups = []

	def read_input(self):
		self.n_w = [int(x) for x in input().split(' ')]
		self.cups = [int(x) for x in input().split(' ')]

	def process_task(self):
		self.cups.sort()
		max_per_g = self.n_w[1] / 3 / self.n_w[0]
		real_per_g = min(self.cups[0], max_per_g)
		max_per_b = max_per_g * 2
		real_per_b = min(2 * real_per_g, self.cups[self.n_w[0]])
		ammount = 1.5 * self.n_w[0] * real_per_b
		self.result = str(ammount)

	def get_result(self):
		return self.result
Solution = CodeforcesTask557BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, w) = map(int, input().split())
l = list(map(int, input().split()))
sortedArray = sorted(l)
girls = sortedArray[0:n]
boys = sortedArray[n:n * 2]
minGirl = girls[0]
minBoy = boys[0]
teaBoys = 0
teaGirls = 0
if minBoy / 2 <= minGirl:
	teaBoys = minBoy * n
	teaGirls = minBoy / 2 * n
else:
	minBoy = minGirl * 2
	teaBoys = minBoy * n
	teaGirls = minGirl * n
if teaBoys + teaGirls > w:
	print(w)
else:
	print(teaGirls + teaBoys)


(m, w) = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
g = min(l[0], l[m] / 2)
print(min(3 * g * m, w))


from sys import stdin
(n, w) = map(int, stdin.readline().split())
an = list(map(int, stdin.readline().split()))
an.sort()
g = an[0]
b = an[n]
t = w / 3.0
print(min(min(g, t / n) * n * 3, min(b, t * 2 / n) * n * 3 / 2))


from math import ceil
x = [int(i) for i in list(input().split(' '))]
y = [int(i) for i in list(input().split(' '))]
y = sorted(y)
max = y[x[0]]
min = y[0]
if max >= 2 * min:
	max = 2 * min
else:
	min = max / 2
g = min * 3 * x[0]
if g < x[1]:
	if g == ceil(g):
		print(ceil(g))
	else:
		print(g)
else:
	print(x[1])


def maximum_boiling(n, w, a):
	a.sort()
	girl_cup = a[0]
	boy_cup = a[n]
	base_cup = min(girl_cup, boy_cup / 2)
	return min(base_cup * 3 * n, w)

def read_input():
	(n, w) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	return (n, w, a)

def main():
	(n, w, a) = read_input()
	print(maximum_boiling(n, w, a))
main()


(n, w) = map(int, input().split())
lst = [*map(float, input().split())]
lst.sort()
res = min(lst[0], lst[n] / 2, w / 3 / n)
print(res * 3 * n)


(n, w) = input().split()
string = input()
ints = map(int, string.split())
alist = []
for num in ints:
	alist.append(num)
alist.sort()
if alist[0] * 2 <= alist[int(n)]:
	g = alist[0]
else:
	g = alist[int(n)] / 2
ans = 3.0 * float(n) * g
if ans <= float(w):
	print(ans)
else:
	print(w)


(n, w) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
a.sort()
x = a[0]
y = a[n]
if x * 2 >= y:
	print(min(w, y / 2 * 3 * n))
	exit()
print(min(w, x * 3 * n))


datain = True
if datain:
	(n, w) = map(int, input().split())
	a = list(map(int, input().split()))
else:
	(n, w) = (1, 5)
	a = [2, 3]
a.sort()
g = a[0]
b = a[n]
t = min(g, float(b / 2))
vol = 3 * t * n
print(min(vol, w))


(n, w) = map(int, input().split())
l = sorted(list(map(int, input().split())))
print(min(w, min(l[n] / 2, l[0]) * 3 * n))


(n, w) = input().split()
n = int(n)
w = int(w)
l = input().split()
for i in range(2 * n):
	l[i] = int(l[i])
l.sort()
(g, b) = (l[0], l[n])
if g * 2 > b:
	if n * (b / 2 + b) > w:
		print(w)
	else:
		print(n * (b / 2 + b))
elif n * (g + g * 2) > w:
	print(w)
else:
	print(n * (g + g * 2))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
result = 0
i = a[0]
max_of_size_cup = a[n]
if float(max_of_size_cup) / 2 <= i:
	result = max_of_size_cup * n + float(max_of_size_cup) / 2 * n
else:
	while i >= 0:
		if i * 2 > max_of_size_cup:
			i = float(i) / 2
		else:
			result = i * n + i * 2 * n
			break
print(min(result, w))


def read_data():
	(n, w) = map(int, input().split())
	As = list(map(int, input().split()))
	return (n, w, As)

def solve(n, w, As):
	As.sort()
	cap_girls = As[0]
	cap_boys = As[n]
	if cap_girls * 2 < cap_boys:
		return min(cap_girls * 3 * n, w)
	else:
		return min(cap_boys * 1.5 * n, w)
(n, w, As) = read_data()
print(solve(n, w, As))


(n, w) = [int(_) for _ in input().split()]
a = list((int(_) for _ in input().split()))
a.sort()
x = min(a[0], a[n] / 2)
print(min(3 * x * n, w))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
x = n * 3 * l[0]
y = n * 3 * l[n] / 2
print(min(min(x, y), k))


(n, w) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
a.sort()
if 2 * a[0] <= a[n]:
	print(min(w, 3 * a[0] * n))
else:
	print(min(w, 1.5 * a[n] * n))


def max_water(friends, w, cups):
	heso1 = w / (3 * friends)
	cups.sort()
	heso2_girl = cups[0]
	heso3_boy = cups[friends] / 2
	min_water = min(heso1, heso2_girl, heso3_boy)
	return min_water * 3 * friends
(friends, w) = list(map(int, input().split()))
cups = list(map(int, input().split()))
print(max_water(friends, w, cups))


(n, w) = [int(x) for x in input().split()]
sOC = [int(x) for x in input().split()]
sOC.sort()
r1 = sOC[n]
r2 = sOC[0]
if r1 / 2 <= r2:
	k = 3 / 2 * r1 * n
	if k < w:
		print(k)
	else:
		print(w)
else:
	k = 3 * r2 * n
	if k < w:
		print(k)
	else:
		print(w)


(n, w) = map(int, input().split())
a = sorted(list(map(int, input().split())))
x = min(a[0], a[n] / 2)
m = 3 * n * x
if m <= w:
	print(m)
else:
	print(w)


(n, w) = map(int, input().split())
a = []
a = list(map(int, input().split()))
a.sort(reverse=True)
boy_max = a[n - 1]
girl_max = a[2 * n - 1]
if girl_max * 2 < boy_max:
	boy_max = girl_max * 2
else:
	girl_max = boy_max / 2
tea_max = min(w, (girl_max + boy_max) * n)
print(tea_max)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
x = min(l[0], l[n] / 2)
ans = x * n + 2 * x * n
print(min(ans, k))


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_abc(l, r, m):
	for a in range(l, r + 1):
		r = m % a
		if r == 0:
			print(a, a, a)
			return
		else:
			c = l + a - r
			print(c)
			if c <= r:
				print(a, l, c)
				return

def cnt_substrs(k, s):
	n = 0
	m = 0
	for c in s:
		if c == '1':
			n += 1
		else:
			m += 1
	if k == 0:
		return nck(m, 2)
	return nck(n, k) * (m + 1)

def get_mx(n, p, q, r, a):
	mx = max(a)
	mn = min(a)
	res = 0
	ls = [p, q, r]
	ls.sort()
	for i in range(3):
		if ls[i] < 0:
			res += ls[i] * mn
		else:
			res += ls[i] * mx
	return res

def find_v(n, w, a):
	a.sort()
	x = min(a[0], a[n + 1 - 1] / 2)
	x = min(x, w / (3 * n))
	return 3 * x * n
t = 1
while t:
	t = t - 1
	(k, g) = (0, 0)
	points = []
	(n, w) = map(int, input().split())
	a = list(map(int, input().strip().split()))[:2 * n]
	print(find_v(n, w, a))


def main():
	import sys
	tokens = [int(i) for i in sys.stdin.read().split()]
	tokens.reverse()
	(n, w) = (tokens.pop(), tokens.pop())
	a = [tokens.pop() for i in range(2 * n)]
	a.sort()
	print(min(w, min(a[0], a[n] / 2) * 3 * n))
main()


(n, w) = map(int, input().split())
cups = sorted([int(x) for x in input().split()])
girl = cups[0]
boys = cups[n]
both = min(girl, boys / 2)
print(min(n * both + 2 * n * both, w))


first = list(map(int, input().split()))
arr = list(map(int, input().split()))
n = first[0]
l = len(arr)
w = first[1]
arr.sort()
each = w / (n * 3)
maxBoy = each * 2
minGirl = arr[0]
minBoy = arr[l // 2]
if minGirl * 2 > minBoy:
	minGirl = minBoy / 2
if each <= minGirl:
	print(w)
else:
	print(minGirl * 3 * n)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = a[0]
y = a[n]
mini = min(float(y / 2), float(x))
res = float(mini * 3 * n)
if res < w:
	print('%.6f' % res)
else:
	print(w)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bigCup = max(a)

def check(x):
	agar = x / (2 * n * 3)
	for_girl = agar * 2
	for_boy = for_girl * 2
	if a[0] < for_girl or a[n] < for_boy:
		return False
	return True
right = w
left = 0
mid = (left + right) / 2
while left + 1e-07 < right:
	mid = (left + right) / 2
	if check(mid):
		left = mid
	else:
		right = mid
print(mid)


q = 1
for _ in range(q):
	(n, w) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	ans1 = n * 3 * l[0]
	ans2 = 3 * n * l[n] / 2
	print(min(min(ans1, ans2), w))


(*a,) = map(int, input().split())
(*b,) = sorted(map(int, input().split()))
c = min(b[0], b[a[0]] / 2, a[1] / a[0] / 3)
print(c * a[0] * 3)


A = input().split()
B = input().split()
a = [int(x) for x in list(B)]
a.sort()
dt = min(a[0], a[int(A[0])] / 2) * 3 * int(A[0])
print(min(dt, int(A[1])))