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

def kado(cur,a,b,c):
  if cur==N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else 10**9
  cal1=kado(cur+1,a,b,c)
  cal2=kado(cur+1,a+lis[cur],b,c)+10
  cal3=kado(cur+1,a,b+lis[cur],c)+10
  cal4=kado(cur+1,a,b,c+lis[cur])+10
  return min(cal1,cal2,cal3,cal4)
print(kado(0,0,0,0))