N,A,B,C=map(int,input().split());a=[[0,0,0,-30]]
for i in range(N):l=int(input());a=[[p[j]+l*(i==j)for j in[0,1,2]]+[p[3]+(i<3)*10]for i in range(4)for p in a]
print(min(abs(p[0]-A)+abs(p[1]-B)+abs(p[2]-C)+p[3]for p in a if min(p[:3])>0))