#coding:utf-8
import itertools

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

l = []

for n in range(N):
    l.append(int(input()))

result = 10000000

'''
upper_A = min([abs(A - length) for length in l])
upper_B = min([abs(B - length) for length in l])
upper_C = min([abs(C - length) for length in l])
'''


def get_min(A,target):
    if len(A)==1:
        MP = min([abs(target-l[a]) for a in A])
    else:
        if target in [l[i] for i in A]:
            MP=0
            return MP
        MP = 1000000
        for n in range(2,len(A)+1):
            for c in itertools.combinations(A, n):
                MP = min(MP, abs(target - sum([l[i] for i in c])) + 10 * (n-1))
    return MP


for i in range(3**N):
    shugo = {}
    for n in range(N):
        shugo[n] = int(i / 3**(n)) % 3

    index_A = [k for k,s in shugo.items() if s==0]
    if len(index_A)==0:
        continue
    index_B = [k for k,s in shugo.items() if s==1]
    if len(index_B)==0:
        continue
    index_C = [k for k,s in shugo.items() if s==2]
    if len(index_C)==0:
        continue

    result = min(result,get_min(index_A,A)+get_min(index_B,B)+get_min(index_C,C))

print(result)    

    
