#! /usr/bin/env ruby

N = gets.chop.to_i
V = gets.chop.split.map(&:to_i).unshift(nil)
C = gets.chop.split.map(&:to_i).unshift(nil)

@choice_pattern_list = [[]]

def choice(i, choice_pattern)
  choice_pattern << i
  @choice_pattern_list << choice_pattern.dup
  bulk_choice(i+1, choice_pattern.dup)
end

def bulk_choice(start, choice_pattern)
  (start..N).to_a.each do |i|
    choice(i, choice_pattern.dup)
  end
end

bulk_choice(1, [])

result = @choice_pattern_list.map do |choice_pattern|
  choice_pattern.inject(0) do |sum, i|
    sum += V[i] - C[i]
  end
end << 0

p result.max