def TtoF(a):
  r = ''
  while a >= 1:
    r += str(a%4)
    a = a // 4
  return r
n,a,b,c = map(int,input().split())
l = [int(input()) for i in range(n)]
m = float('INF')
for i in range(1,4**n):
  cur = TtoF(i)
  cur = '0'*(n-len(cur)) + cur
  abc = [[] for i in range(3)]
  for j in range(n):
    if cur[j] != '3':
      abc[int(cur[j])].append(l[j])
  if [] in abc:
    continue
  else:
    m = min(m,10*(len(abc[0])-1)+abs(sum(abc[0])-a)+10*(len(abc[1])-1)+abs(sum(abc[1])-b)+10*(len(abc[2])-1)+abs(sum(abc[2])-c))
print(m)