import itertools
import sys

N,A,B,C = map(int,input().split())

l_list = []
for i in range(N):
    l_list.append(int(input()))
l_list.sort()

MP = float('inf')

for i in range(3,N+1):
    cs = itertools.combinations(range(1,i),2)

    for c in cs: 
        ps = itertools.permutations(l_list,i)
        for p in ps:
            AA = sum(p[:c[0]])
            BB = sum(p[c[0]:c[1]])
            CC = sum(p[c[1]:])
            tmp = abs(AA-A) + abs(BB-B) + abs(CC-C) + (i - 3)*10
            if tmp < MP:
                MP = tmp

print(MP)