N,A,B,C = map(int,input().split())
l = [int(input()) for _ in range(N)]
ans = float('inf')
def dfs(d=0,a=0,b=0,c=0,mp=0):
    if d == N:
        mp = mp + abs(A-a) + abs(B-b) + abs(C-c) - 30
        global ans
        if a*b*c > 0 and mp < ans:
            ans = mp
        return
    dfs(d+1,a,b,c,mp)
    dfs(d+1,a+l[d],b,c,mp+10)
    dfs(d+1,a,b+l[d],c,mp+10)
    dfs(d+1,a,b,c+l[d],mp+10)

dfs()
print(ans)