N, A, B, C = map(int, raw_input().split())
l = [input() for _ in range(N)]
 
def cost(X, x):
  t = 0
  c = 0
  for i in range(N):
    if x>>i&1:
      t += l[i]
      c += 1
  return (c-1)*10 + abs(X-t)
 
ans = 10000
for a in range(1, 1<<N):
  ac = cost(A, a)
  for b in range(1, 1<<N):
    if (a&b)==0:
      bc = cost(B, b)
      for c in range(1, 1<<N):
        if ((a|b)&c)==0:
          cc = cost(C, c)
          ans = min(ans, ac+bc+cc)
print ans
