N,A,B,C=map(int,input().split())
T=[A,B,C]
L=[int(input()) for i in range(N)]
ans=1999999999
for i in range(4**N):
  L_=[[] for i in range(4)]
  for k in range(N):
    r=i%4
    i=(i-r)//4
    L_[r].append(L[k])
  if len(L_[0])*len(L_[1])*len(L_[2])==0:
    continue
  MP=10*(len(L_[0])+len(L_[1])+len(L_[2])-3)
  for r in range(3):
    s=0
    for l in L_[r]:
      s+=l
    MP+=abs(s-T[r])
  ans=min(ans,MP)
print(ans)