N,A,B,C =map(int,input().split())

l = [int(input()) for i in range(N)]

INF =10**9

def dfs(cnt,a,b,c):
    if cnt == N:
    #30引くのは元のa,b,cだけならコストかからんから
        return abs(A-a)+abs(B-b) + abs(C-c)-30 if min(a,b,c)>0 else INF
    
    ret0 = dfs(cnt+1 ,a,b,c)
    ret1 = dfs(cnt+1,a+l[cnt],b,c)+10
    ret2 = dfs(cnt+1,a,b+l[cnt],c)+10
    ret3 = dfs(cnt+1,a,b,c+l[cnt])+10
    
    return min(ret0,ret1,ret2,ret3)


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