n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
inf=10**9

def dfs(cur,p,q,r):
    if cur==n:
        return abs(p-a)+abs(q-b)+abs(r-c)-30 if min(a,b,c)>0 else inf
    ret0=dfs(cur+1,p,q,r)
    ret1=dfs(cur+1,p+l[cur],q,r)+10
    ret2=dfs(cur+1,p,q+l[cur],r)+10
    ret3=dfs(cur+1,p,q,r+l[cur])+10
    return min(ret0,ret1,ret2,ret3)

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