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

def dps(a,b,c,index):
  if index == N:
    return abs(a-A) + abs(b-B) + abs(c-C) if min(a,b,c) != 0 else float('infinity')
  
  take = L[index]
  mp1 = dps(a,b,c,index+1)
  mp2 = dps(a+take,b,c,index+1) + 10
  mp3 = dps(a,b+take,c,index+1) + 10
  mp4 = dps(a,b,c+take,index+1) + 10

  return min(mp1,mp2,mp3,mp4)


print(dps(0,0,0,0)-30)