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