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

def dfs(count,x,y,z):
    if count == n:
        if a>0 and b>0 and c>0:
            return abs(x-a)+abs(y-b)+abs(z-c)-30 
        else:
            return 0
    ret0 = dfs(count+1,x,y,z)
    ret1 = dfs(count+1,x+L[count],y,z)+10
    ret2 = dfs(count+1,x,y+L[count],z)+10
    ret3 = dfs(count+1,x,y,z+L[count])+10
    
    return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))
