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

def base2n(Num,n):
    if Num<n:
        return str(Num)
    else:
        return base2n(Num//n,n)+str(Num%n)

ans=10**6
    
for i in range(4**N):
    i_4=("0"*N+base2n(i,4))[-N:]
    Group=[[] for i in range(4)]
    for j in range(N):
        Group[int(i_4[j])-1].append(l[j])
    if len(Group[0])*len(Group[1])*len(Group[2])==0:
        pass
    else:
        ans=min(ans,(2-len(Group[3]))*10+sum([abs(ABC[j] - sum(Group[j])) for j in range(3)]))
        
print(ans)