class Point
  include Comparable
  attr_accessor :x, :y
  def initialize(x=0.0, y=0.0)
    @x, @y = x.to_f, y.to_f
  end
  def <=>(p)
    @y!=p.y ? @y<=>p.y : @x<=>p.x
  end
  def -(p)
    Point.new(@x-p.x, @y-p.y)
  end

  def abs
    Math::hypot(@x, @y)
  end
  def angle
    Math::atan2(@y, @x)
  end
end

while (n=gets.to_i) != 0 do
  flag = Array.new
  n.times do
    flag.push(Point.new(*gets.split.reverse))
  end

  pre = Point.new
  now = flag.sort!.shift
  length = (now-pre).abs
  while !flag.empty? do
    min = 2.0 * Math::PI
    nextPoint = nil
    flag.each do |nex|
      angle = (nex-now).angle - (now-pre).angle
      angle += 2.0 * Math::PI if angle < 0.0
      next if min < angle
      next if min==angle && (nextPoint-now).abs<(nex-now).abs
      nextPoint = nex
      min = angle
    end
    pre, now = now, nextPoint
    flag.delete(nextPoint)
    length += (now-pre).abs
  end
  printf "%.1f\n", length
end