Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — the probability that this friend will come up with a problem if Andrey asks him.

Help Andrey choose people to ask. As he needs only one problem, Andrey is going to be really upset if no one comes up with a problem or if he gets more than one problem from his friends. You need to choose such a set of people that maximizes the chances of Andrey not getting upset.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 100) — the number of Andrey's friends. The second line contains n real numbers p_{i} (0.0 ≤ p_{i} ≤ 1.0) — the probability that the i-th friend can come up with a problem. The probabilities are given with at most 6 digits after decimal point.


-----Output-----

Print a single real number — the probability that Andrey won't get upset at the optimal choice of friends. The answer will be considered valid if it differs from the correct one by at most 10^{ - 9}.


-----Examples-----
Input
4
0.1 0.2 0.3 0.8

Output
0.800000000000

Input
2
0.1 0.2

Output
0.260000000000



-----Note-----

In the first sample the best strategy for Andrey is to ask only one of his friends, the most reliable one.

In the second sample the best strategy for Andrey is to ask all of his friends to come up with a problem. Then the probability that he will get exactly one problem is 0.1·0.8 + 0.9·0.2 = 0.26.

Difficulty: MEDIUM_HARD
Tags: Greedy algorithms

Mathematics

Probability
Skill types: Greedy algorithms

Starter code:

Solutions:
import sys
input()
ps = sorted((float(p) for p in input().split()), reverse=True)
if 1.0 in ps:
	print(1)
	sys.exit()
(a, b) = (0, 1)
for p in ps:
	(c, d) = (a + p / (1 - p), b * (1 - p))
	if c * d > a * b:
		(a, b) = (c, d)
	else:
		break
print('{:.9}'.format(a * b))


n = int(input())
P = list(map(float, input().split()))
if 1 in P:
	print(1)
	exit(0)
Q = []
for i in P:
	Q.append(1 - i)
Q.sort()
ans = 0
c1 = 1
c2 = 0
for i in Q:
	if c1 * i * (c2 + 1 / i - 1) > ans:
		ans = c1 * i * (c2 + 1 / i - 1)
		c1 *= i
		c2 += 1 / i - 1
print(ans)


n = int(input())
a = list(map(float, input().split()))
m = max(a)
if m >= 0.5:
	print(m)
elif len(a) == 1:
	print(a[0])
else:
	a.sort()
	b = [1 - a[i] for i in range(len(a))]
	m = 0
	for i in range(n):
		sum = 0
		for k in range(n - i - 1, n):
			prod = 1
			for j in range(n - i - 1, n):
				if k != j:
					prod = prod * b[j]
				else:
					prod = prod * a[k]
			sum = sum + prod
		m = max(m, sum)
	print(m)


n = input()
ans = tmp = 0.0
pd = 1.0
for i in reversed(sorted(map(float, input().split()))):
	tmp = tmp * (1.0 - i) + pd * i
	pd *= 1.0 - i
	ans = max(ans, tmp)
print('%0.12f' % ans)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
n = rint()
p = sorted((float(s) for s in input().split()), reverse=True)
pr = 0
inv = 1
for pi in p:
	npr = pr * (1 - pi) + inv * pi
	if npr < pr:
		break
	pr = npr
	inv *= 1 - pi
print(pr)


def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return [int(x) for x in inputs.split()]
	if mode == 3:
		return [float(x) for x in inputs.split()]

def write(s='\n'):
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
(n,) = read()
s = read(3)
s.sort(reverse=True)
s = [int(10 ** 6 * i + 0.5) for i in s]
onewin = s[0]
alllose = 10 ** 6 - s[0]
ct = 1
while alllose > onewin and ct < n:
	onewin = onewin * (10 ** 6 - s[ct]) + alllose * s[ct]
	alllose *= 10 ** 6 - s[ct]
	ct += 1
print(onewin / 10 ** (6 * ct))


import sys
n = int(input())
index = [i for i in range(n)]
tmp = list(map(float, sys.stdin.readline().split()))
ans = []
maxP = 0
while len(index):
	j = 0
	ma = 0
	for k in index:
		if tmp[k] >= ma:
			ma = tmp[k]
			j = k
	index.remove(j)
	ans.append(tmp[j])
	tp = 0
	for i in range(len(ans)):
		q = ans[i]
		for k in range(len(ans)):
			if i != k:
				q *= 1 - ans[k]
		tp += q
	if tp > maxP:
		maxP = tp
	else:
		ans.remove(tmp[j])
print('{0:.9f}'.format(maxP))


n = int(input())
l = [float(x) for x in input().split()]
assert len(l) == n
l.sort()
if l[-1] == 1:
	print('%11.10f' % 1)
else:
	sig = 0
	prod = 1
	while sig < 1 and len(l) > 0:
		x = l.pop()
		sig += x / (1 - x)
		prod *= 1 - x
	print('%11.10f' % (sig * prod))


(k, p) = (int(input()), list(map(float, input().split())))
p.sort(reverse=True)
if p[0] == 1:
	print(1)
else:
	a = 1
	b = v = 0
	for i in p:
		a *= 1 - i
		b += i / (1 - i)
		u = a * b
		if v > u:
			break
		v = u
	print(v)


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def cal(probs):
	np = [1 - p for p in probs]
	p = 0
	left = 1
	right = 1
	for v in np:
		right *= v
	for i in range(len(probs)):
		right /= np[i]
		cp = left * right * probs[i]
		left *= np[i]
		p += cp
	return p

def solve(N, A):
	if any([abs(v - 1.0) < 10 ** (-9) for v in A]):
		print(1.0)
		return
	A.sort(reverse=True)
	ans = A[0]
	for size in range(2, N + 1):
		if A[size - 1] == 0:
			break
		ans = max(ans, cal(A[:size]))
	print(ans)
N = int(input())
A = [float(x) for x in input().split()]
solve(N, A)


def main():
	count_of_friends = int(input())
	list_of_friends_chances = [float(i) for i in input().split(' ')]
	list_of_friends_chances.sort()
	max_number = max(list_of_friends_chances)
	list_of_lists = []
	for t in range(0, count_of_friends):
		list_last = []
		for i in range(t, count_of_friends):
			var_temp = list_of_friends_chances[i]
			for j in range(t, count_of_friends):
				if i != j:
					var_temp *= 1 - list_of_friends_chances[j]
			list_last.append(var_temp)
		list_of_lists.append(sum(list_last))
	max_sum_of_lists = max(list_of_lists)
	if max_sum_of_lists > max_number:
		print(max_sum_of_lists)
	else:
		print(max_number)
main()


n = int(input())
pr = list(map(float, input().split()))
pr.sort(reverse=True)
p = 1 - pr[0]
if p == 0:
	print(1)
else:
	s = pr[0] / (1 - pr[0])
	pps = p * s
	for i in range(1, len(pr)):
		p *= 1 - pr[i]
		s += pr[i] / (1 - pr[i])
		ps = p * s
		if pps > ps:
			break
		pps = ps
	print(pps)


def main():
	input()
	ps = map(float, input().split())
	ps = sorted(ps, reverse=True)
	if ps[0] == 1:
		print(1)
	else:
		p = 1 - ps[0]
		s = ps[0] / (1 - ps[0])
		for x in ps[1:]:
			if s >= 1:
				break
			p *= 1 - x
			s += x / (1 - x)
		print(p * s)
main()


n = input()
p = [float(x) for x in input().split()]
p.sort(reverse=True)
maxans = 0
for i in range(len(p)):
	ans = 0
	for j in range(i + 1):
		temp = p[j]
		for k in range(i + 1):
			if k != j:
				temp *= 1 - p[k]
		ans += temp
	if ans > maxans:
		maxans = ans
print(maxans)


import bisect
n = int(input())
ls = list(map(float, input().split()))
ls.sort()
mx = ls[-1]
idx = bisect.bisect_left(ls, 0.5)
if idx < n and ls[idx] < 0.5:
	idx += 1
res = 0
st = 0
while st < idx - 1:
	temp = 0
	for i in range(st, idx):
		t = 1
		for j in range(st, idx):
			if i != j:
				t = t * (1 - ls[j])
		temp += t * ls[i]
	res = max(res, temp)
	st += 1
res = max(res, mx)
print('%.12f' % res)


from decimal import *
getcontext().prec = 500
n = int(input())
p = sorted(map(Decimal, input().split()))

def ans(p):
	ans = Decimal(0)
	for i in range(len(p)):
		cur = Decimal(1)
		for j in range(len(p)):
			if j == i:
				cur = cur * p[j]
			else:
				cur = cur * (Decimal(1) - p[j])
		ans += cur
	return ans
print('%.100f' % max((ans(p[i:]) for i in range(n))))


from decimal import Decimal as fr
ans = 0
n = int(input())
a = list(map(fr, input().split()))
ans = max(a)

def calc(lst):
	nonlocal ans
	prod = 1
	for i in range(len(lst)):
		prod *= 1 - lst[i]
		cur = 0
		for j in range(i + 1):
			cur += lst[j] * prod / (1 - lst[j])
		ans = max(ans, cur)
lst = list(sorted([x for x in a if x < 0.5]))
calc(lst)
calc(lst[::-1])
print('{:.15f}'.format(ans))


input()
(p, s, ans) = (1.0, 0.0, 0.0)
for x in sorted(map(float, input().split()), reverse=True):
	if x == 1:
		ans = 1
		break
	p = p * (1 - x)
	s = s + x / (1 - x)
	ans = max(ans, p * s)
print(ans)


import math
import sys
N = int(input())
P = list(map(float, input().split()))
P = sorted(P, reverse=True)
if 1.0 in P:
	print(1.0)
	return

def solve(P_):
	log_prod_all = 0
	for p in P_:
		log_prod_all += math.log(1 - p)
	return sum([math.exp(math.log(p) - math.log(1 - p) + log_prod_all) for p in P_])
print(max([solve(P[:i]) for i in range(len(P) + 1)]))


from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def is_it_local():
	script_dir = str(os.getcwd()).split('/')
	username = 'dipta007'
	return username in script_dir

def READ(fileName):
	if is_it_local():
		sys.stdin = open(f'./{fileName}', 'r')
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')
if not is_it_local():
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def input1(type=int):
	return type(input())

def input2(type=int):
	[a, b] = list(map(type, input().split()))
	return (a, b)

def input3(type=int):
	[a, b, c] = list(map(type, input().split()))
	return (a, b, c)

def input_array(type=int):
	return list(map(type, input().split()))

def input_string():
	s = input()
	return list(s)

def main():
	n = input1()
	arr = input_array(float)
	arr.sort(reverse=True)
	res = arr[0]
	prev_inverted = 1 - arr[0]
	for i in range(1, n):
		nw = arr[i] * prev_inverted + res * (1 - arr[i])
		if nw > res:
			res = nw
			prev_inverted *= 1 - arr[i]
	print(res)
	pass
READ('in.txt')
main()


import sys
f = sys.stdin
n = int(f.readline().strip())
p = [float(u) for u in f.readline().strip().split()]
p.sort(reverse=True)
p0 = 1
p1 = 0
p2 = 0
for pi in p:
	(p0t, p1t) = (p0 * (1 - pi), p0 * pi + p1 * (1 - pi))
	if p1t > p1:
		(p0, p1) = (p0t, p1t)
	else:
		break
print(p1)


n = input()
ans = tmp = 0.0
prod = 1.0
for p in reversed(sorted(map(float, input().split()))):
	tmp = tmp * (1.0 - p) + prod * p
	prod *= 1.0 - p
	ans = max(ans, tmp)
print('%0.9f' % ans)


n = int(input())
a = sorted(list(map(float, input().split())))
s = a[-1]
p = 1 - a[-1]
for i in range(n - 2, -1, -1):
	if s < s * (1 - a[i]) + a[i] * p:
		s = s * (1 - a[i]) + a[i] * p
		p *= 1 - a[i]
print(s)


n = int(input())
p = list(map(float, input().split()))
p.sort()
p.reverse()
p0 = 1
p1 = 0
for i in range(n):
	if p1 < p1 * (1 - p[i]) + p0 * p[i]:
		tmp = p0
		p1 = p1 * (1 - p[i]) + p0 * p[i]
		p0 = tmp * (1 - p[i])
print(p1)


from sys import stdin, stdout
from collections import defaultdict, Counter
from bisect import bisect, bisect_left
import math
from itertools import permutations
I = stdin.readline
n = int(I())
arr = [float(x) for x in I().split()]
arr.sort(reverse=True)
ma = arr[0]
for i in range(1, n):
	now = ma * (1 - arr[i])
	sec = 1
	for j in range(i):
		sec *= 1 - arr[j]
	now += arr[i] * sec
	if now > ma:
		ma = now
	else:
		break
print(ma)


def main():
	n = int(input())
	a = list(map(float, input().split()))
	a.sort(reverse=True)
	ans = 0
	for (i, v) in enumerate(a):
		tempans = 0
		for (j, v1) in enumerate(a[:i + 1]):
			p = 1
			for (k, v3) in enumerate(a[:i + 1]):
				if j == k:
					p *= v3
				else:
					p *= 1 - v3
			tempans += p
		ans = max(ans, tempans)
	print(ans)
	return
main()


n = int(input())
pr = list(map(float, input().split()))
pr.sort(reverse=True)
pr.insert(0, 0)
mx = 0
for k in range(1, len(pr)):
	cur = 0
	for j in range(1, k + 1):
		jth = 1
		for i in range(1, j):
			jth *= 1 - pr[i]
		jth *= pr[j]
		for i in range(j + 1, k + 1):
			jth *= 1 - pr[i]
		cur += jth
	mx = max(mx, cur)
print(mx)


n = int(input())
l = list(map(float, input().split()))
l = sorted(l)
l = l[::-1]
ans = 0
d = 1
vze = 0
for x in l:
	vze = vze + x * (d - vze)
	d *= 1 - x
	ans = max(ans, vze)
print(ans)


n = int(input())
a = list(reversed(sorted(list(map(float, input().split())))))
A = a[0]
B = 1 - a[0]
for i in range(1, n):
	if (1 - a[i]) * A + a[i] * B > A:
		A = (1 - a[i]) * A + a[i] * B
		B *= 1 - a[i]
print(A)


from functools import reduce
L0 = []

def getP():
	return sum([reduce(lambda y, x: y * x, [L0[j] if j == i else 1 - L0[j] for j in range(len(L0))], 1) for i in range(len(L0))])
input()
L = [float(x) for x in input().split()]
L.sort(reverse=True)
if len(L) > 0 and L[0] == 1:
	print(1)
else:
	S = 0
	for p in L:
		if S < 1:
			S += p / (1 - p)
			L0.append(p)
		else:
			break
	print(getP())


def readln():
	return tuple(map(int, input().split()))
(n,) = readln()
ans = tmp = 0.0
prod = 1.0
for p in reversed(sorted(map(float, input().split()))):
	tmp = tmp * (1.0 - p) + prod * p
	prod *= 1.0 - p
	ans = max(ans, tmp)
print('%0.9f' % ans)


input()
p = sorted(map(float, input().split(' ')))
m = max(p)
p = [(1 - i, i) for i in p]

def konv(a, b):
	return (a[0] * b[0], a[0] * b[1] + a[1] * b[0])
while len(p) > 1:
	p.append(konv(p.pop(), p.pop()))
	m = max(m, p[-1][1])
print(m)


import sys
n = int(sys.stdin.readline())
p = [float(x) for x in sys.stdin.readline().split()]
p.sort()
d = [(1 - x, x, 0) for x in p]
m = max(p)

def konv(a, b):
	return (a[0] * b[0], a[0] * b[1] + a[1] * b[0], 0)
while len(d) > 1:
	a = d.pop()
	b = d.pop()
	c = konv(a, b)
	m = max(m, c[1])
	d.append(c)
print(m)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))
mod = 1000000007

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

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

def comb(n, r):
	if n < r:
		return 0
	else:
		return fac[n] * (finv[r] * finv[n - r] % mod) % mod

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def arr1d(n, v):
	return [v] * n

def arr2d(n, m, v):
	return [[v] * m for _ in range(n)]

def arr3d(n, m, p, v):
	return [[[v] * p for _ in range(m)] for i in range(n)]
ans = []

def solve():
	pb = 0
	ps = 0
	pp = 1
	n = N()
	p = list(fsep())
	p.sort(reverse=True)
	for i in range(n):
		if p[i] == 1.0:
			print(p[i])
			return
		f = 1 - p[i]
		ps += 1 / f - 1
		pp *= f
		if ps * pp > pb:
			pb = ps * pp
		else:
			pass
	print(pb)
solve()


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
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')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

def calc(e):
	tot = 0
	for i in range(len(e)):
		s = 1
		for j in range(len(e)):
			if i == j:
				s *= e[i]
			else:
				s *= 1 - e[j]
		tot += s
	return tot
n = int(input())
l = list(map(float, input().split()))
if n == 1:
	print(l[0])
	sys.exit(0)
ans = max(l)
end = n
l.sort()
for i in range(n):
	if l[i] >= 0.5:
		end = i
		break
l = l[:end]
e = []
for i in range(len(l) - 1, -1, -1):
	e.append(l[i])
	d = calc(e)
	ans = max(ans, d)
print(ans)


n = int(input())
prob = [float(x) for x in input().split(' ')]
prob.sort()
if prob[-1] >= 0.5:
	print(prob[-1])
	quit()
prob = [x for x in prob if x > 0.0]
if len(prob) == 0:
	print('0')
	quit()
bestP = 0.0
for start in range(0, len(prob)):
	curP = 0.0
	curI = 1.0
	for end in range(start, len(prob)):
		curP = curI * prob[end] + curP * (1 - prob[end])
		curI *= 1 - prob[end]
		if bestP < curP:
			bestP = curP
print(bestP)


import fractions
import operator
import functools

def calc(d, nd, n):
	r = 0
	for i in range(n):
		r += d[i] * functools.reduce(operator.mul, nd[:i] + nd[i + 1:n], 1)
	return r
n = int(input())
x = tuple(sorted(map(float, str.split(input())), reverse=True))
nx = tuple([1 - p for p in x])
p = 0
for i in range(1, n + 1):
	p = max(p, calc(x[:i], nx[:i], i))
print(float(p))


n = int(input())
from itertools import combinations
a = sorted(list(map(float, input().split())), reverse=True)
if max(a) == 1:
	print(1)
	quit()
n = len(a)
pre = [1] * 100
pre[0] = 1 - a[0]
for i in range(1, n):
	pre[i] = pre[i - 1] * (1 - a[i])
ans = 0
for i in range(1, n + 1):
	anss = 0
	for j in range(i):
		anss = anss + pre[i - 1] / (1 - a[j]) * a[j]
	ans = max(ans, anss)
print(ans)


def C():
	n = int(input())
	tmp = input()
	tmp = tmp.split()
	probability = list(map(float, tmp))
	probability.sort()
	current = probability[n - 1]
	pre = 1 - probability[n - 1]
	for i in range(n - 2, -1, -1):
		tmp = current * (1 - probability[i]) + pre * probability[i]
		if tmp > current:
			current = tmp
			pre = pre * (1 - probability[i])
	print('%.12f' % current)
C()


n = int(input())
l = list(map(float, input().split()))
l.sort(reverse=True)
best = 0
curr0 = 1
curr1 = 0
for v in l:
	curr1 *= 1 - v
	curr1 += v * curr0
	curr0 *= 1 - v
	best = max(curr1, best)
print(best)


n = int(input())
p = list(map(float, input().split()))
p.sort(reverse=True)
prev_prob = 0
cur_prob = 0
T = 1
for i in range(n):
	cur_prob = cur_prob * (1 - p[i]) + T * p[i]
	if cur_prob >= prev_prob:
		prev_prob = cur_prob
		T *= 1 - p[i]
	else:
		break
print(prev_prob)


n = int(input())
a = list(map(float, input().split()))
a.sort(reverse=True)
curZero = 1
curOne = 0
for elem in a:
	if curOne * (1 - elem) + curZero * elem > curOne:
		curOne = curOne * (1 - elem) + curZero * elem
		curZero = curZero * (1 - elem)
	else:
		break
print(curOne)


n = int(input())
a = sorted(map(float, input().split()), reverse=True)
ret = -float('inf')
for i in range(n):
	prob = 0
	for j in range(i + 1):
		p = a[j]
		for k in range(i + 1):
			if k != j:
				p *= 1 - a[k]
		prob += p
	ret = max(ret, prob)
print(ret)


n = int(input())
p = sorted(map(float, input().split()), reverse=True)
np = 1.0 - p[0]
pp = p[0]
ans = pp
for i in range(1, len(p)):
	pp *= 1.0 - p[i]
	pp += p[i] * np
	np *= 1.0 - p[i]
	if ans < pp:
		ans = pp
	else:
		break
print(ans)


def cali(subset):
	z = [1 - i for i in subset]
	ans = 0
	for i in range(len(subset)):
		ha = subset[i]
		for j in range(len(subset)):
			if i != j:
				ha *= z[j]
		ans += ha
	return ans

def solve():
	n = int(input())
	l = list(map(float, input().split()))
	l.sort()
	if l[-1] >= 0.5:
		print(l[-1])
	else:
		ans = 0
		yo = -1
		ha = []
		for i in range(n):
			ha.append(l[yo])
			z = cali(ha)
			ans = max(ans, z)
			yo -= 1
			if yo == -(n + 1):
				break
		print(ans)
solve()


n = int(input())
L = list(map(float, input().split()))
L.sort(reverse=True)
ans1 = 0.0
F = []
Q = []
i = 0
while i < n:
	ans2 = 0
	x = L[i]
	for j in range(len(F)):
		ans2 += F[j] * (1 - L[i])
		x *= 1 - L[Q[j]]
	ans2 += x
	if ans2 > ans1:
		F.append(L[i])
		Q.append(i)
		x = 1
		for j in range(len(F) - 1):
			F[j] *= 1 - L[i]
			x *= 1 - L[Q[j]]
		F[-1] *= x
	ans1 = max(ans2, ans1)
	i += 1
print(ans1)


def __starting_point():
	N = int(input())
	probs = list(map(float, input().split()))
	probs.sort()
	(P, S) = (1.0, 0.0)
	sol = 0.0
	for n in reversed(range(N)):
		if probs[n] == 1.0:
			sol = 1.0
			break
		if S > 1:
			break
		(P, S) = (P * (1 - probs[n]), S + probs[n] / (1 - probs[n]))
		sol = P * S
	print(sol)
__starting_point()


n = int(input())
p = list(map(float, input().split()))
p.sort(reverse=True)
(cnt, flag) = (0, 0)
arr = []
for i in p:
	if i == 1:
		flag = 1
		break
	elif i:
		arr.append(i)
		cnt += 1
	else:
		break
if flag:
	print(1)
elif cnt:
	maxi = arr[0]
	n = cnt
	for i in range(2, n + 1):
		query = p[:i]
		s = 0
		m = 1
		for j in query:
			m *= 1 - j
		for j in query:
			x = m * j / (1 - j)
			s += x
		if s <= 1:
			if maxi < s:
				maxi = s
		else:
			break
	print(maxi)
else:
	print(0)


import sys
input = sys.stdin.readline
n = int(input())
p = list(map(float, input().split()))
p.sort(reverse=True)
max_p = 0
for i in range(n):
	score = 0
	for j in range(i + 1):
		c = 1
		for k in range(i + 1):
			if j == k:
				c *= p[k]
			else:
				c *= 1 - p[k]
		score += c
	if score >= max_p:
		max_p = score
	else:
		break
print(max_p)


x = int(input())
y = list(map(float, input().split(' ')))
y.sort()
y.reverse()
l = [y[0]]
p = y[0]
prod = 1 - y[0]
for i in range(1, x):
	newx = p * (1 - y[i]) + prod * y[i]
	if newx > p:
		prod *= 1 - y[i]
		p = newx
		l.append(y[i])
print(p)


n = int(input())
p = list(map(float, input().split()))
p.sort()
dp = [[0.0 for _ in range(n)] for _ in range(n)]
for i in range(n):
	dp[i][i] = 1.0 - p[i]
	for j in range(i + 1, n):
		dp[i][j] = dp[i][j - 1] * (1.0 - p[j])
ans = p[-1]
for i in range(n):
	for j in range(i + 1, n):
		prob = 0
		for k in range(i, j + 1):
			if k == i:
				prob += p[i] * dp[i + 1][j]
			elif k == j:
				prob += p[j] * dp[i][j - 1]
			else:
				prob += dp[i][k - 1] * p[k] * dp[k + 1][j]
		ans = max(ans, prob)
print(ans)


n = int(input())
a = list(map(float, input().split()))
a.sort()
s = 0
prod = 1
for i in range(n - 1, -1, -1):
	if s < s * (1 - a[i]) + prod * a[i]:
		s = s * (1 - a[i]) + prod * a[i]
		prod *= 1 - a[i]
print('%.9lf' % s)