n,A,B,C=map(int,input().split())
l=[int(input()) for i in range(n)]
def calc(r,a,b,c):
    if r == n:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else 10**9
    else:
        root1 = calc(r+1,a,b,c)
        root2 = calc(r+1,a+l[r],b,c) +10
        root3 = calc(r+1,a,b+l[r],c) +10
        root4 = calc(r+1,a,b,c+l[r]) +10
        return min(root1,root2,root3,root4)
print(calc(0,0,0,0))