A = [0,0,0]
N,A[0],A[1],A[2] = map(int,input().split())
L = [int(input()) for _ in range(N)]
#print(L)

ans = 10 ** 9
for i in range(4**N):
  G = [[] for _ in range(4)]
  for j in range(N):
    G[(i//(4**j))%4].append(L[j])
  #print(G)
  mp = 0
  for j in range(3):
    if len(G[j]) == 0:
      mp = 10 ** 9
      break
    mp += (len(G[j])-1)*10
    mp += abs(sum(G[j])-A[j])
  ans = min(ans,mp)
print(ans)