loop {
	n = gets.to_i
	break if n == 0
	points = (1..n).map{ gets.split.map(&:to_i) }
	points << [0, 0]
	points.sort!
	#p points

	route = []
	loop {
		path = [points[0]]
		1.upto(points.size-1){|i|
			if path.size >= 2
				x1, y1 = path[-2]
				x2, y2 = path[-1]
				x3, y3 = points[i]

				if x1 != x2
					if x2 == x3 || (y2 - y1).to_f / (x2 - x1) < (y3 - y2).to_f / (x3 - x2) 
						path.pop
						redo
					end
				end
			end
			path << points[i]
		}
		#p path
		if path.size == points.size
			route += path
			break
		end
		path.pop
		route += path
		points -= path
		points.reverse!
	}
	#p route
	total_dist = route.each_cons(2).map{|u, v|
		x1, y1 = u
		x2, y2 = v
		Math.sqrt((x1-x2)**2 + (y1-y2)**2)
	}.inject(:+)
	printf("%.1f\n", total_dist)
}