from itertools import combinations, permutations

N, A, B, C = map(int, input().split(" "))
L = [int(input()) for _ in range(N)]

def f(a):
    s, l, x = a
    return (l-1)*10+abs(s-x)
    

min_num = 10**18
for l in permutations(L):
    # print(l)
    for j1, j2, j3 in combinations(range(N), 3):
        sum_num = sum(map(f, [(sum(l[j1:j2]), j2-j1, A), (sum(l[j2:j3]), j3-j2, B), (sum(l[j3:]), N-j3, C)]))
        # if sum_num < min_num:
            # print(l)
        min_num = min(min_num, sum_num)

print(min_num)