N=gets.to_i
V=gets.split.map &:to_i
C=gets.split.map &:to_i

ans = 0
1.upto(N) do |k|
  (0...N).to_a.combination(k) do |c|
    x = c.map{|i| V[i]}.inject :+
    y = c.map{|i| C[i]}.inject :+
    ans = [ans, x - y].max
  end
end
p ans
