import itertools
N,A,B,C=map(int,input().split())
l = [int(input()) for _ in range(N)]
#A,B,Cに近づくように合成する
#N-3本を3個に分類する→最大3**5通り
ans = 10**9
lis = list(itertools.combinations_with_replacement([0,1,2],8))
for i in lis:
    if len(set(i))<2:
        continue
    else:
        a = 0
        b = 0
        c = 0
        for j in range(N):
            if i[j] == 0:
                a += l[j]
            elif i[j] == 1:
                b += l[j]
            else:
                c += l[j]
            tmp = abs(A-a)+abs(B-b)+abs(C-c)
            ans = min(ans,tmp)
print(ans+(N-3)*10)
 