n,A,B,C=map(int,input().split())
l=[int(input()) for i in range(n)]
INF=10**9

def dfs(cur,a,b,c):
    if cur == n:
        if min(a,b,c)>0:
            return abs(a-A)+abs(b-B)+abs(c-C)-30
        else:
            return INF
    pat0=dfs(cur+1,a+l[cur],b,c)+10
    pat1=dfs(cur+1,a,b+l[cur],c)+10
    pat2=dfs(cur+1,a,b,c+l[cur])+10
    pat3=dfs(cur+1,a,b,c)
    return min(pat0,pat1,pat2,pat3)

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