n,a,b,c = map(int,input().split())
li = [int(input()) for _ in range(n)]

inf = 1000000
def cost(N,x,y,z):
  if N == n:
    if x*y*z == 0:
      return inf
    return abs(x-a) + abs(y-b) + abs(z-c)
  
  cost1 = cost(N+1,x,y,z)
  cost2 = cost(N+1,x+li[N],y,z) + 10
  cost3 = cost(N+1,x,y+li[N],z) + 10
  cost4 = cost(N+1,x,y,z+li[N]) + 10
  return min(cost1,cost2,cost3,cost4)

print(cost(0,0,0,0)-30)