program average_length
  implicit none
  integer :: n, i, j
  real(8) :: x(8) = 0.d0, y(8) = 0.d0, m = 0.d0
  read(*,*) n
  do i = 1, n
    read(*,*) x(i), y(i)
  end do
  do i = 1, n-1
    do j = i+1, n
      m = m+d2(x(i),y(i),x(j),y(j))
    end do
  end do
  m = 2.d0*m/real(n,8)
  write(*,*) m
contains
  real(8) function d(x,y)
    real(8) :: x, y
    d = sqrt(x*x+y*y)
  end
  real(8) function d2(x1,y1,x2,y2)
    real(8) :: x1, y1, x2, y2
    d2 = d(x2-x1,y2-y1)
  end
end program average_length