N, A, B, C = map(int, input().split())
D = [A, B, C]
L = [0] * N
for i in range(N):
  L[i] = int(input())
MP = 3000
for i in range(4 ** N):
  E = [0, 0, 0]
  mp = 0
  for j in range(N):
    n = i % 4
    if n < 3:
      mp += 10 if E[n] else 0
      E[n] += L[j]
    i >>= 2
  for i in range(3):
    mp += abs(D[i] - E[i]) if E[i] else 3000
  MP = min(mp, MP)
print(MP)