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: competition

Starter code:

Solutions:
n = int(input())
a = list(map(float, input().split()))
a.sort()
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('%.9lf' % s)


"""
Codeforces Round 253 Div 1 Problem B

Author  : chaotic_iak
Language: Python 3.3.4
"""

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    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="")

################################################### SOLUTION
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 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(fractions.Fraction, str.split(input())), reverse=True))
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())

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)


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 sys

input()
ps = sorted((float(p) for p in input().split()), reverse=True)
if 1.0 in ps:
    print(1)
    return
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))


#!/usr/bin/env python3


def main():
    input()
    ps = list(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)

def __starting_point():
    main()

__starting_point()

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)

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)



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)

def __starting_point():
    main()
__starting_point()

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)

def __starting_point():
    C()

__starting_point()

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)


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)):
		# print(probs[n])
		if probs[n] == 1.0:
			sol = 1.0
			break
		if S > 1:
			# print(S + (probs[n]/(1 - probs[n])))
			break
		P, S = P*(1 - probs[n]), S + probs[n]/(1 - probs[n])
		# print(P, S, P*S)
		sol = P*S
	print(sol)
__starting_point()

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



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)



# Made By Mostafa_Khaled


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)



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

#        print(cur)
        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))


from sys import stdin,stdout
from collections import defaultdict,Counter
from bisect import bisect,bisect_left
import math
from itertools import permutations 

#stdin = open('input.txt','r')
I = stdin.readline






n = int(I())
arr = [float(x) for x in I().split()]

arr.sort(reverse = True)
ma = arr[0]
#print(ma)
for i in range(1,n):
    now = ma*(1-arr[i])
    #print(now)
    sec = 1
    for j in range(i):
        sec*=(1-arr[j])
   # print(sec*arr[i],sec,arr[i])
    now+=(arr[i]*sec)
    #print(ma,now)
    if(now>ma):
        ma = now
    else:
        break

print(ma)



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

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)

# Contest: 20 - 2100 <= Codeforces Rating <= 2199 (https://a2oj.com/ladder?ID=20)
# Problem: (16) Andrey and Problem (Difficulty: 4) (http://codeforces.com/problemset/problem/442/B)

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)


n = int(input())
P = list(map(float, input().split()))
if 1 in P:
    print(1)
    return
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)

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



#442B
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)