N, A, B, C = gets.split.map(&:to_i)
LS = []
N.times do
  LS << gets.to_i
end

INF = 10 ** 9

def rec(cur, a, b, c)
  if N == cur
    return ([a, b, c].min > 0) ? (A-a).abs + (B-b).abs + (C-c).abs - 30 : INF
  else
    ret0 = rec(cur+1, a, b, c)
    ret1 = rec(cur+1, a+LS[cur], b, c) + 10
    ret2 = rec(cur+1, a, b+LS[cur], c) + 10
    ret3 = rec(cur+1, a, b, c+LS[cur]) + 10
    return [ret0, ret1, ret2, ret3].min
  end
end

puts rec(0, 0, 0, 0)