n, A, B, C = map(int, input().split())
l = [int(input()) for i in range(n)]
INF=10**9

# idx: current index
# a: length of bamboo for A
# b: length of bamboo for B
# c: length of bamboo for C
def dfs(cur, a, b, c):
  if cur == n:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  none = dfs(cur + 1, a, b, c)
  fora = dfs(cur + 1, a + l[cur], b, c) + 10
  forb = dfs(cur + 1, a, b + l[cur], c) + 10
  forc = dfs(cur + 1, a, b, c + l[cur]) + 10
  print(none,fora,forb,forc)
  return min(none, fora, forb, forc)

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