n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
global ans
ans = sum([a, b, c])
def count(a_use, b_use, c_use, non_use):
  global ans
  if a_use and b_use and c_use:
    cost = abs(sum(a_use)-a)+abs(sum(b_use)-b)+abs(sum(c_use)-c) + 10*((len(a_use)-1) + (len(b_use)-1) +(len(c_use)-1) )
    ans = min(cost, ans)
  for i in range(len(non_use)):
    temp = non_use[:]
    temp.pop(i)
    use = [non_use[i]]
    count(a_use+use, b_use, c_use, temp)
    count(a_use, b_use+use, c_use, temp)
    count(a_use, b_use, c_use+use, temp)
    count(a_use, b_use, c_use, temp)
count([], [], [], l)
print(ans)