N,A,B,C=map(int,input().split())
l=[]
for _ in range(N):
    l.append(int(input()))

def dfs(counter,a,b,c):
    if a==A and b==B and c==C:
            return counter
    ret1=dfs(counter+1,a+l[counter],b,c)+10
    ret2=dfs(counter+1,a,b+l[counter],c)+10
    ret3=dfs(counter+1,a,b,c+l[counter])+10
    ret4=dfs(counter+1,a+1,b,c)+1
    ret5=dfs(counter+1,a,b+1,c)+1
    ret6=dfs(counter+1,a,b,c+1)+1
    return min(ret1,ret2,ret3,ret4,ret5,ret6)

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