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
elsif first == 0 || second == 0
  p "infinity"
elsif first.abs > second.abs
  p 0
else
  dif = first + second
  if first%dif == 0
    p (((first/dif-1).to_i*2)+1).abs
  else
    p (((first/dif).to_i*2)+1).abs
  end
end