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

def dfs(num,A,B,C):
    if num == n:
        return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(A,B,C)>0 else float("inf")
    v1 = dfs(num+1,a,b,c)
    v2 = dfs(num+1,a+banboo[num],b,c) + 10
    v3 = dfs(num+1,a,b+banboo[num],c) + 10
    v4 = dfs(num+1,a,b,c+banboo[num]) + 10
    return min(v1,v2,v3,v4)
dfs(0,0,0,0)