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

def magic(cur,a,b,c):
  if cur==N:
    if a*b*c!=0:
      return abs(a-A)+abs(b-B)+abs(c-C)-30
    else:
      return 10**9
  r0=magic(cur+1,a,b,c)
  r1=magic(cur+1,a+l[cur],b,c)+10
  r2=magic(cur+1,a,b+l[cur],c)+10
  r3=magic(cur+1,a,b,c+l[cur])+10
  return min(r0,r1,r2,r3)

print(magic(0,0,0,0))