T = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

b = ( T[0] * B[0] + T[1] * B[1] ) - ( T[0] * A[0] + T[1] * A[1] )
if b == 0
  puts 'infinity'
end
a = T[0] * ( A[0] - B[0] )
puts ( a / b ) * 2 + 1