N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
def dfs(k,a,b,c):
    global N,A,B,C,l
    if k == N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else 1000000
    det0 = dfs(k+1, a+l[k], b, c)+10
    det1 = dfs(k+1, a, b+l[k], c)+10
    det2 = dfs(k+1, a, b, c+l[k])+10
    det3 = dfs(k+1, a, b, c)
    return min(det0, det1, det2, det3)
print(dfs(0,0,0,0))