program interval_running
  implicit none
  real(8) :: t(2), a(2), b(2), ya, yb, tt
  integer :: m = 0, i = 1
  read(*,*) t
  read(*,*) a
  read(*,*) b
  if (sum(a*t) == sum(b*t)) then
    write(*,'(a)') "infinity"
    stop
  end if
  if ((a(1)-b(1))*(a(2)-b(2)) > 0.d0) then
    write(*,'(i0)') 0
    stop
  end if
  ya = t(1)*a(1)
  yb = t(1)*b(1)
  tt = t(1)
  do
    i = 3-i
    tt = (ya-yb)/(b(i)-a(i))
    if (tt < 0.d0 .or. t(i) < tt) exit
    m = m+1
    ya = ya+t(i)*a(i)
    yb = yb+t(i)*b(i)
  end do
  write(*,'(i0)') m
end program interval_running