program engines
  implicit none
  integer :: n, i, j
  real(8) :: r(100,2) = 0.d0, p(2) = 0.d0, ans = 0.d0
  logical :: used(100) = .false.
  character(64) :: tmp
  read(*,*) n
  do i = 1, n
    read(*,*) r(i,:)
  end do
  do i = 1, n
    p = 0.d0
    used(1:n) = .false.
    do j = 1, n
      if (dot_product(r(i,:),r(j,:)) > 0.d0) then
        p = p+r(j,:)
        used(j) = .true.
      end if
    end do
    do j = 1, n
      if (used(j)) cycle
      if (d(p+r(j,:)) > d(p)) then
        p = p+r(j,:)
      end if
    end do
    ans = max(ans,d(p))
  end do
  write(tmp,'(f50.20)') ans
  write(*,'(a)') trim(adjustl(tmp))
contains
  real(8) function d(a)
    real(8), intent(in) :: a(2)
    d = sqrt(a(1)*a(1)+a(2)*a(2))
  end
end program engines