t1,t2 = list(map(int, input().split()))

a1,a2 = list(map(int, input().split()))

b1,b2 = list(map(int, input().split()))

x,y=(a1-b1)*t1 + (a2-b2)*t2, (a1-b1)*t1

if x == 0:

    print("infinity")

elif x*y > 0:

    print((0))

else:

    s,t = divmod(abs(y), abs(x))

    print((s*2+(1 if t else 0)))

t,T,a,A,b,B=list(map(int, open(0).read().split()))

x,y=(a-b)*t,(A-B)*T

if x+y==0:

 r="infinity"

else:

 s,t=divmod(-x, x+y)

 r=0 if s<0 else s*2+(1 if t else 0)

print(r)
t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
x, y = (a1 - b1) * t1 + (a2 - b2) * t2, (a1 - b1) * t1
if x == 0:
    print("infinity")
elif x * y > 0:
    print((0))
else:
    s, t = divmod(abs(y), abs(x))
    print((s * 2 + (1 if t else 0)))

t, T, a, A, b, B = list(map(int, open(0).read().split()))
x, y = (a - b) * t, (A - B) * T
if x + y == 0:
    r = "infinity"
else:
    s, t = divmod(-x, x + y)
    r = 0 if s < 0 else s * 2 + (1 if t else 0)
print(r)

-t1, t2 = list(map(int, input().split())) -a1, a2 = list(map(int, input().split())) -b1, b2 = list(map(int, input().split())) -x, y = (a1 - b1) * t1 + (a2 - b2) * t2, (a1 - b1) * t1 -if x == 0: -    print("infinity") -elif x * y > 0: -    print((0)) +t, T, a, A, b, B = list(map(int, open(0).read().split())) +x, y = (a - b) * t, (A - B) * T +if x + y == 0: +    r = "infinity" -    s, t = divmod(abs(y), abs(x)) -    print((s * 2 + (1 if t else 0))) +    s, t = divmod(-x, x + y) +    r = 0 if s < 0 else s * 2 + (1 if t else 0) +print(r)