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))
ZGVmIGNob29zZShuLGspOgogICAgaWYgayA9PSAwOiByZXR1cm4gMQogICAgcmV0dXJuIGNob29zZShuLTEsay0xKSAqIG4gLy8gawoKZnJvbSBoZWFwcSBpbXBvcnQgaGVhcHB1c2gsIGhlYXBwb3AKCk4gPSBpbnQoIGlucHV0KCkgKQpwcm9icyA9IFsgZmxvYXQoeCkgZm9yIHggaW4gaW5wdXQoKS5zcGxpdCgpIF0KCiMgZ2VuZXJhdGUgYWxsIGVxdWl2YWxlbmNlIGNsYXNzZXMgYW5kIHB1c2ggdGhlbSBpbnRvIHRoZSBwcmlvcml0eSBxdWV1ZQpRID0gW10KZm9yIHMgaW4gcmFuZ2UoTisxKToKICAgIGZvciBjIGluIHJhbmdlKE4rMS1zKToKICAgICAgICBmb3IgciBpbiByYW5nZShOKzEtcy1jKToKICAgICAgICAgICAgZiA9IE4tcy1jLXIKICAgICAgICAgICAgcHAgID0gcHJvYnNbMF0qKnMgKiBwcm9ic1sxXSoqYyAqIHByb2JzWzJdKipyICogcHJvYnNbM10qKmYKICAgICAgICAgICAgY250ID0gY2hvb3NlKE4scykgKiBjaG9vc2UoTi1zLGMpICogY2hvb3NlKE4tcy1jLHIpCiAgICAgICAgICAgIGhlYXBwdXNoKCBRLCAocHAsY250KSApCgojIGJ1aWxkIEh1ZmZtYW4gY29kZSwgYWx3YXlzIHByb2Nlc3NpbmcgYWxsIGVxdWl2YWxlbnQgbm9kZXMgYXQgb25jZQojIG5vdGUgdGhhdCB0aGUgY29zdCBpcyBjb21wdXRlZCBpbmNyZW1lbnRhbGx5OgojIGVhY2ggdGltZSB3ZSBtZXJnZSB0d28gdmVydGljZXMgaW50byBvbmUsIHdlIGFkZCB0aGUgY29zdCBvZiB0aG9zZSB0d28gZWRnZXMKCnRvdGFsX2Nvc3QgPSAwCndoaWxlIFRydWU6CiAgICBwcCwgY250ID0gaGVhcHBvcChRKQogICAgaWYgY250ID4gMToKICAgICAgICBoYWxmID0gY250Ly8yCiAgICAgICAgdG90YWxfY29zdCArPSAyKnBwKmhhbGYgCiAgICAgICAgaGVhcHB1c2goIFEsICgyKnBwLGhhbGYpICkKICAgICAgICBpZiBjbnQlMjogaGVhcHB1c2goIFEsIChwcCwxKSApCiAgICBlbHNlOgogICAgICAgIGlmIGxlbihRKT09MDogYnJlYWsKICAgICAgICBwcDIsIGNudDIgPSBoZWFwcG9wKFEpCiAgICAgICAgdG90YWxfY29zdCArPSBwcCtwcDIKICAgICAgICBoZWFwcHVzaCggUSwgKHBwK3BwMiwxKSApCiAgICAgICAgaWYgY250MiA+IDE6IGhlYXBwdXNoKCBRLCAocHAyLGNudDItMSkgKQoKcHJpbnQoJ3s6LjEyZn0nLmZvcm1hdCh0b3RhbF9jb3N0KSk=