n,a,b,c=map(int,input().split())
l=[]
for i in range(n):
    l.append(int(input()))

def solve(w,x,y,z):
    if w==n:
        if min(x,y,z)>0:
            return abs(x-a)+abs(y-b)+abs(z-c)-30
        else:
            return 10e4
        can0=solve(w+1,x,y,z)
        can1=solve(w+1,x+l[w],y,z)+10
        can2=solve(w+1,x,y+l[w],z)+10
        can3=solve(w+1,x,y,z+l[w])+10
        return min(can0,can1,can2,can3)

print(solve(0,0,0,0))
