n = gets.chomp!.to_i
vs = gets.chomp!.split(" ")
vs = vs.map{|item| item = item.to_i}
cs = gets.chomp!.split(" ")
cs = cs.map{|item| item = item.to_i}
vcs = []

for i in 0..n-1
	vcs = vcs + [Complex(vs[i],cs[i])]
end

ans = -Float::INFINITY

for kosu in 0..n
	vcs.combination(kosu){|arr| 
		alans = 0
		for j in 0..arr.length-1
			alans = alans + arr[j].real - arr[j].imag
		end
		
		if ans <= alans && alans >= 0 then
		ans = alans
		end
	}
end

puts ans