from itertools import product
N, a, b, c = map(int, input().split())
L = []
for i in range(N):
  L.append(int(input()))

abc = [0,a,b,c]
ch = [0,1,2,3]
cal = []

for i in product(ch,repeat=N):
  calc = 0
  su = [0,0,0,0]
  ct = [0,0,0,0]
  temp = list(i)
  for j in range(N):
    su[temp[j]] += L[j]
    ct[temp[j]] += 1
  for k in range(1,4):
    calc += abs(abc[k]-su[k])
    calc += max((ct[k]-1),0)*10
  cal.append(calc)
    
print(min(cal))