N, A, B, C = list(map(int, input().split()))
data = [int(input()) for i in range(N)]

INF = 10**11
def magic(i, a, b, c):
  if i == N:
    return abs(A-a) + abs(B-b) + abs(C-c)-30 if min([a, b, c]) > 0 else INF
  ret0 = magic(i+1, a, b, c)
  ret1 = magic(i+1, a+data[i], b, c)+10
  ret2 = magic(i+1, a, b+data[i], c)+10
  ret3 = magic(i+1, a, b, c+data[i])+10
  return min([ret0, ret1, ret2, ret3])

print(magic(0, 0, 0, 0))