import itertools

def list_difference(list1, list2):
  result = list1.copy()
  for value in list2:
    if value in result:
      result.remove(value)
  return result

N,A,B,C = map(int, input().split())
lst = [int(input()) for i in range(N)]
ans_lst = []
for i in range(1, N-1):
  sub_lst = list(itertools.combinations(lst,i))
  for j in sub_lst:
    diff_lst = list_difference(lst, list(j))
    diff_lst.append(sum(list(j)))
    diff_lst.sort(reverse=True)
    ans_lst.append(abs(A - diff_lst[0]) + abs(B - diff_lst[1]) + abs(C - diff_lst[2]) + 10 * (i - 1))

print(min(ans_lst))
      