N,A,B,C = map(int,input().split())

l = [int(input()) for _ in range(N)]

inf = 10 ** 10

def mp(i,a,b,c):
  if i == N:
    return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else inf
  mp0 = mp(i+1,a,b,c)
  mp1 = mp(i+1,a+l[i],b,c)+10
  mp2 = mp(i+1,a,b+l[i],c)+10
  mp3 = mp(i+1,a,b,c+l[i])+10
  return min(mp0,mp1,mp2,mp3)

print(mp(0,0,0,0))