t = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
if (t[0]*a[0]+t[1]*a[1] == t[0]*b[0]+t[1]*b[1])
    puts "infinity"
    exit
end
if (a[0] > b[0]) 
    a,b = b,a
end
u = t[0]*a[0]+t[1]*a[1]
v = t[0]*b[0]+t[1]*b[1]
if (v > u)
    puts 0
    exit
end
ok = 0
ng = 2**62
while (ng-ok > 1)
    mid = (ok+ng)/2;
    if (mid*u+t[0]*a[0] <= mid*v+t[0]*b[0])
        ok = mid
    else
        ng = mid
    end
end
puts ng*2-1