n,A,B,C=map(int,input().split())
l=[int(input()) for _ in range(n)]
inf = 10**9
def dfs(t,a,b,c):
    if t == n:
        if min(a,b,c)>0: return abs(a-A)+abs(b-B)+abs(c-C)-30
        else: return inf
    ret0 = dfs(t+1,a,b,c)
    ret1 = dfs(t+1,a+l[t],b,c)+10
    ret2 = dfs(t+1,a,b+l[t],c)+10
    ret3 = dfs(t+1,a,b,c+l[t])+10
    return min(ret0,ret1,ret2,ret3)

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