from copy import copy
N, A, B, C = map(int, input().split())
L = []
for _ in range(N):
  L.append(int(input()))

INF = 10 ** 9
def dfs(cur, a, b, c, m):
  if cur == N-1:
    if min(a, b, c) == 0:
      return INF
    return abs(A-a)+abs(B-b)+abs(C-c)+(m-3)*10

  res0 = dfs(cur+1, a, b, c, m)
  res1 = dfs(cur+1, a+L[cur], b, c, m+1)
  res2 = dfs(cur+1, a, b+L[cur], c, m+1)
  res3 = dfs(cur+1, a, b, c+L[cur], m+1)

  return min(res0, res1, res2, res3)

print(dfs(0, 0, 0, 0, 0))
