n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=float('inf')
for i in range(4**n):
    abc=[[] for i in range(4)]
    for j in range(n):
        abc[i%4].append(l[j])
        i//=4
    A,B,C,x=abc
    if len(A)==0 or len(B)==0 or len(C)==0:
        continue
    ans=min(ans,abs(sum(A)-a)+abs(sum(B)-b)+abs(sum(C)-c)+(len(A)+len(B)+len(C)-3)*10)
print(ans)