INF = float('inf')
def dfs(a=0,b=0,c=0,d=0):
    if d==N:
        return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,min(b,c)) else INF
    ans = dfs(a,b,c,d+1)
    ans = min(ans,dfs(a+l[d],b,c,d+1)+10)
    ans = min(ans,dfs(a,b+l[d],c,d+1)+10)
    ans = min(ans,dfs(a,b,c+l[d],d+1)+10)
    return ans

N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
print(dfs())
