N = gets.to_i
$v_list = gets.split.map(&:to_i)
$c_list = gets.split.map(&:to_i)

def dfs(i, x, y)
  if i == N
    return x - y
  end
  v = $v_list[i]
  c = $c_list[i]
  [
    dfs(i + 1, x + v, y + c),
    dfs(i + 1, x, y)
  ].max
end
ans = dfs(0, 0, 0)
puts ans
