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 pi (0.0 ≤ pi ≤ 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.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms

Mathematics

Probability


Solutions:
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())
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)


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)


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)


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


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)


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


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)