data = input().split()
N = int(data[0])
A = int(data[1])
B = int(data[2])
C = int(data[3])

i = 0
kd = []
while i < N:
  kd.append(int(input()))
  i += 1


cur = 0 
sc = 0
def ans(n,a,b,c):
  if cur == N:
    return abs(a-A) + abs(b-B)+ abs(c-C) - 30 if min(a,b,c) > 0 else 1000000
  ret0 = ans(cur+1,a,b,c)
  ret1 =  ans(cur+1,a+kd[cur],b,c) + 10
  ret2 = ans(cur + 1,a,b+kd[cur],c) +10 
  ret3 = ans(cur+1,a,b,c+kd[cur])+ 10
  return min(ret0,ret1,ret2,ret3)

print(ans(0,0,0,0))
    
    

       
  