t, T = gets.chomp.split(" ").map(&:to_i)
a, A = gets.chomp.split(" ").map(&:to_i)
b, B = gets.chomp.split(" ").map(&:to_i)
first = (a-b)*t
second = (A-B)*T
if first == -second
  p "infinity"
elsif first > 0 && second > 0
  p 0
elsif first < 0 && second < 0
  p 0
else
  sum = 0
  count = 0
  no_change = 1
  first_pin = 1
  while true do
    if first_pin == 1
      sum_after = sum + first
      first_pin = 0
    else
      sum_after = sum + second
      first_pin = 1
    end
    if sum*sum_after < 0
      count += 1
      no_change_after = 1
    else
      no_change_after = 0
    end
    if no_change == 0 && no_change_after == 0
      break
    end
    sum = sum_after
    no_change = no_change_after
  end
  p count
end
  
    