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
u = t[0]*a[0]+t[1]*a[1]
v = t[0]*b[0]+t[1]*b[1]
ok = 0
ng = 2**62
while (ng-ok > 1)
    mid = (ok+ng)/2;
    x = [u*mid,v*mid]
    y = [u*mid+t[0]*a[0],v*mid+t[0]*b[0]]
    z = [u*(mid+1),v*(mid+1)]
    if ((z[0] > z[1]) != (y[0] > y[1]))
        ok = mid
    else
        ng = mid
    end
end
ans = ng*2-1
puts ans