n = gets().to_i
vn = gets().split(' ').map(&:to_i)
cn = gets().split(' ').map(&:to_i)

mx = 0
(0 ... (1 << n)).each {|bit|
	x = 0
	y = 0

	(0 ... n).each {|i|
		if bit & (1 << i) != 0
			x += vn[i]
			y += cn[i]
		end
	}

	mx = x - y if mx < x - y
}

puts mx
