n,a,b,c=map(int,input().split())
tree=[a,b,c]
ls=[int(input()) for _ in range(n)]
ans=10000
for i in range(4**n):
    group=[[] for _ in range(4)]
    for j in range(n):
        k,i=i%4,i//4
        group[k].append(ls[j])
    buf=0
    for l in range(3):
        group_len=len(group[l])
        if group_len==0:
            buf=10000
            break
        buf+=(group_len-1)*10+abs(sum(group[l])-tree[l])
    ans=min(ans,buf)
print(ans)