def choose(n,k):
    if k == 0: return 1
    return choose(n-1,k-1) * n // k

from heapq import heappush, heappop

N = int( input() )
probs = [ float(x) for x in input().split() ]

# generate all equivalence classes and push them into the priority queue
Q = []
for s in range(N+1):
    for c in range(N+1-s):
        for r in range(N+1-s-c):
            f = N-s-c-r
            pp  = probs[0]**s * probs[1]**c * probs[2]**r * probs[3]**f
            cnt = choose(N,s) * choose(N-s,c) * choose(N-s-c,r)
            heappush( Q, (pp,cnt) )

# build Huffman code, always processing all equivalent nodes at once
# note that the cost is computed incrementally:
# each time we merge two vertices into one, we add the cost of those two edges

total_cost = 0
while True:
    pp, cnt = heappop(Q)
    if cnt > 1:
        half = cnt//2
        total_cost += 2*pp*half 
        heappush( Q, (2*pp,half) )
        if cnt%2: heappush( Q, (pp,1) )
    else:
        if len(Q)==0: break
        pp2, cnt2 = heappop(Q)
        total_cost += pp+pp2
        heappush( Q, (pp+pp2,1) )
        if cnt2 > 1: heappush( Q, (pp2,cnt2-1) )

print('{:.12f}'.format(total_cost))