n=gets.to_i
v=gets.split.map &:to_i
c=gets.split.map &:to_i
max=0
[0,1].repeated_permutation(n).each do |i|
  sum=0
  for j in 0..n-1
    if i[j]==1
      sum+=(v[j]-c[j])
    end
  end
  max=[max,sum].max
end
puts max
