#119_C
N,A,B,C=map(int,input().split())
l=[int(input()) for _ in range(N)]
INF=10**9

def dfs(x,a,b,c):
    if x==N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF
    res0=dfs(x+1,a,b,c)
    res1=dfs(x+1,a+l[x],b,c)+10
    res2=dfs(x+1,a,b+l[x],c)+10
    res3=dfs(x+1,a,b,c+l[x])+10
    return min(res0,res1,res2,res3)
    
print(dfs(0,0,0,0))