N = gets.to_i A = gets.split.map(&:to_f) B = gets.split.map(&:to_f) ans = 0.0 N.times do |i| ans += 2 * Math.sqrt(A[i] * B[i]) end puts ans