n = gets.split(" ").map(&:to_i)

v = []

v = gets.split(" ").map(&:to_i)

c = []

c = gets.split(" ").map(&:to_i)


v_c = [v,c].transpose.map{|a| a.inject(:-) }

v_c = v_c.sort

sum = 0

v_c.each do |v_c|
  if v_c <= 0
    next
  end
  sum += v_c

end

print sum

