N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
def dfs(d, a, b, c):
  if d == N:
    res = abs(a - A) + abs(b - B) + abs(c - C) - 30
    return 1e9 if min(a, b, c) == 0 else res
  ret = [0] * 4
  ret[0] = dfs(d + 1, a, b, c)
  ret[1] = dfs(d + 1, a + l[d], b, c) + 10
  ret[2] = dfs(d + 1, a, b + l[d], c) + 10
  ret[3] = dfs(d + 1, a, b, c + l[d]) + 10
  return min(ret)
print(dfs(0, 0, 0, 0))
