str = gets.split
T1,T2 = str[0].to_i, str[1].to_i
str = gets.split
a1,a2 = str[0].to_i, str[1].to_i
str = gets.split
b1,b2 = str[0].to_i, str[1].to_i
if T1*a1 + T2*a2 == T1*b1 + T2*b2
    puts "infinity"
    exit
end
if (a1-b1) * (a2-b2) > 0
    puts 0
end
if a1 < b1
    swap = a1
    a1 = b1
    b1 = swap
    swap = a2
    a2 = b2
    b2 = swap
end
if a1*T1 + a2*T2 > T1*b1 + T2*b2
    puts 0
end
dif1 = T1*a1 - b1*T1
dif2 = T1*b1 + T2*b2 - a1*T1 - a2*T2
answer = (dif1/dif2)*2 + 1
if dif1%dif2 == 0
    answer -= 1
end
puts answer