from itertools import product
a = [0, 0, 0]
N, a[0], a[1], a[2] = list(map(int,input().split()))
l = []
for i in range(N):
  l.append(int(input()))
mm = float("inf")
for p in product(range(4), repeat=N):
  c = [0]*4
  s = [0]*4
  for i in range(N):
    c[p[i]] += 1
    s[p[i]] += l[i]
  if min(c[:3])==0:
    continue
  m = 0
  for j in range(3):
    m += max(0, c[j]-1)*10
    m += abs(a[j]-s[j])
  mm = min(mm, m)
print(mm)