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

def search(now, a, b, c):
  if now == N:
    return abs(A-a) + abs(B-b) + abs(C-c) if min(a, b, c) > 0 else INF
  MP0 = search(now+1, a, b, c)
  MP1 = search(now+1, a+l[now], b, c) + 10
  MP2 = search(now+1, a, b+l[now], c) + 10
  MP3 = search(now+1, a, b, c+l[now]) + 10
  return min(MP0, MP1, MP2, MP3)

print(search(0,0,0,0)-30)