n = gets.to_i
v = gets.split().map {|v| v.to_i}
c = gets.split().map {|v| v.to_i}

v_c = v.zip(c).map{ |v, c| v - c}

max = 0

1.upto(v_c.size) do |i|
  v_c.combination(i).collect do |arr|
    sum = arr.inject(:+)
    max = sum if max <= sum
  end
end

p max
