local n, a, b, c = io.read("*n", "*n", "*n", "*n")
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end
local minscore = 3000
local tot = 4^n
local mabs, mmin = math.abs, math.min
for i = 0, tot - 1 do
  local ti = i
  local score = 0
  local ts = {0, 0, 0}
  for j = 1, n do
    local rem = ti % 4
    if(0 < rem) then
      if(ts[rem] == 0) then ts[rem] = t[j]
      else ts[rem] = ts[rem] + t[j]; score = score + 10 end
    end
    ti = ti // 4
  end
  score = score + mabs(a - ts[1]) + mabs(b - ts[2]) + mabs(c - ts[3])
  if(0 < ts[1] * ts[2] * ts[3]) then
    minscore = mmin(minscore, score)
  end
end
print(minscore)
