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

ans = 0
(1).upto(n) do |i|
  (0..(n-1)).to_a.combination(i) do |j|
    x = j.map{|e| v[e]}.inject(:+)
    y = j.map{|e| c[e]}.inject(:+)
    ans = [ans, x - y].max
  end
end
puts ans