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)
t,T,a,A,b,B=list(map(int, open(0).read().split()))

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

if y-x==0:

 r="infinity"

else:

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

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

print(r)
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)

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

-x, y = (a - b) * t, (A - B) * T -if x + y == 0: +x, y = (b - a) * t, (A - B) * T +if y - x == 0: -    s, t = divmod(-x, x + y) -    r = 0 if s < 0 else s * 2 + (1 if t else 0) +    s, t = divmod(x, y - x) +    r = max(0, s * 2 + (1 if t else 0))