T1, T2 = gets.split.map(&:to_i)
A1, A2 = gets.split.map(&:to_i)
B1, B2 = gets.split.map(&:to_i)

if A1 < B1
  a1, a2, b1, b2 = B1, B2, A1, A2
else
  a1, a2, b1, b2 = A1, A2, B1, B2
end

lenA = a1 * T1 + a2 * T2
lenB = b1 * T1 + b2 * T2

# A ---->---->
# B -->------>
if lenA == lenB
  puts 'infinity'
  exit
end

# A ----->----->
# B --->---->
if a1 > b1 && a2 > b2
  puts 0
  exit
end

# A ------->--->
# B -->------>
if lenA > lenB
  puts 0
  exit
end

# A ----->--->
# B --->------->
D = lenB - lenA
FD = T1 * (a1 - b1)

# A ----->-->
# B -->--------------->
if FD < D
  puts 1
  exit
end

ok = 0
ng = 10 ** 10

while ng - ok > 1
  x = (ok + ng) / 2

  if D * x <= FD
    ok = x
  else
    ng = x
  end
end

puts 1 + 2 * ok
