# solution

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

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

for i in product(ch,repeat=nim):
  calc = 0
  su = [0,0,0,0]
  ct = [0,0,0,0]
  temp = list(i)
  for j in range(nim):
    su[temp[j]] += array[j]
    ct[temp[j]] += 1
  if (ct[1]==0)|(ct[2]==0)|(ct[3]==0):
    continue
  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)) from itertools import product nim, a, b, c = map(int, input().split()) nim map(int, input().split()) map int input().split() ().split () input split a b c array = [] array [] for i in range(nim):
  array.append(int(input())) i range(nim) range nim array.append(int(input())) array.append array append int(input()) int input() input abc = [0,a,b,c] abc [0,a,b,c] 0 a b c ch = [0,1,2,3] ch [0,1,2,3] 0 1 2 3 cal = [] cal [] for i in product(ch,repeat=nim):
  calc = 0
  su = [0,0,0,0]
  ct = [0,0,0,0]
  temp = list(i)
  for j in range(nim):
    su[temp[j]] += array[j]
    ct[temp[j]] += 1
  if (ct[1]==0)|(ct[2]==0)|(ct[3]==0):
    continue
  for k in range(1,4):
    calc += abs(abc[k]-su[k])
    calc += max((ct[k]-1),0)*10
  cal.append(calc)
     i product(ch,repeat=nim) product ch repeat=nim repeat nim calc = 0 calc 0 su = [0,0,0,0] su [0,0,0,0] 0 0 0 0 ct = [0,0,0,0] ct [0,0,0,0] 0 0 0 0 temp = list(i) temp list(i) list i for j in range(nim):
    su[temp[j]] += array[j]
    ct[temp[j]] += 1
   j range(nim) range nim su[temp[j]] += array[j] su[temp[j]] su temp[j] temp j array[j] array j ct[temp[j]] += 1 ct[temp[j]] ct temp[j] temp j 1 if (ct[1]==0)|(ct[2]==0)|(ct[3]==0):
    continue
   (ct[1]==0)|(ct[2]==0)|(ct[3]==0) (ct[1]==0)|(ct[2]==0) ct[1]==0 ct[1] ct 1 0 ct[2]==0 ct[2] ct 2 0 ct[3]==0 ct[3] ct 3 0 continue for k in range(1,4):
    calc += abs(abc[k]-su[k])
    calc += max((ct[k]-1),0)*10
   k range(1,4) range 1 4 calc += abs(abc[k]-su[k]) calc abs(abc[k]-su[k]) abs abc[k]-su[k] abc[k] abc k su[k] su k calc += max((ct[k]-1),0)*10 calc max((ct[k]-1),0)*10 max((ct[k]-1),0) max ct[k]-1 ct[k] ct k 1 0 10 cal.append(calc) cal.append cal append calc print(min(cal)) print min(cal) min cal array = [] [] array ct = [0,0,0,0] [0,0,0,0] ct nim, a, b, c = map(int, input().split()) map(int, input().split()) nim calc += max((ct[k]-1),0)*10 max((ct[k]-1),0)*10 calc calc = 0 0 calc a, b, c = map(int, input().split()) map(int, input().split()) a cal = [] [] cal b, c = map(int, input().split()) map(int, input().split()) b abc = [0,a,b,c] [0,a,b,c] abc temp = list(i) list(i) temp ch = [0,1,2,3] [0,1,2,3] ch su = [0,0,0,0] [0,0,0,0] su calc += abs(abc[k]-su[k]) abs(abc[k]-su[k]) calc c = map(int, input().split()) map(int, input().split()) c
# solution

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

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

for i in product(ch,repeat=nim):
  calc = 0
  su = [0,0,0,0]
  ct = [0,0,0,0]
  temp = list(i)
  for j in range(nim):
    su[temp[j]] += array[j]
    ct[temp[j]] += 1
  if (ct[1]==0)|(ct[2]==0)|(ct[3]==0):
    continue
  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))