import itertools
N, *A = map(int,input().split())
l = [int(input()) for i in range(N)]
li =  itertools.product(range(4), repeat=N)

ans = float("inf")
for i in li:
  cnt = [0]*3
  length = [0]*3
  for k in range(N):
    if i[k] == 3: 
      continue
    cnt[i[k]] += 1
    length[i[k]] += l[k]
  if min(cnt) > 0:
    cost = sum([abs(length[i]-A[i]) +10*cnt[i] for i in range(3)]) -30
    ans = min(ans, cost)
  
print(ans)