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

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

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

n1=(b1-a1)*t1

n2=(b2-a2)*t2

if n1*n2>0 or abs(n1)>abs(n2):

  print((0))

elif abs(n1)==abs(n2):

  print('infinity')

else:

  c=abs(n1)//abs(n1+n2)

  while (c+1)*abs(n1+n2)<=abs(n1):

    c+=1

  ans=2*c

  if abs(n1)%(abs(n1+n2))!=0:

    ans+=1

  print(ans)
import sys

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

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

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

n1=(b1-a1)*t1

n2=(b2-a2)*t2

if n1*n2>0 or abs(n1)>abs(n2):

  print((0))

  sys.exit()

if abs(n1)==abs(n2):

  print('infinity')

  sys.exit()

c=abs(n1)//abs(n1+n2)

while (c+1)*abs(n1+n2)<=abs(n1):

  c+=1

ans=2*c

if abs(n1)%(abs(n1+n2))!=0:

  ans+=1

print(ans)

t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
n1 = (b1 - a1) * t1
n2 = (b2 - a2) * t2
if n1 * n2 > 0 or abs(n1) > abs(n2):
    print((0))
elif abs(n1) == abs(n2):
    print("infinity")
else:
    c = abs(n1) // abs(n1 + n2)
    while (c + 1) * abs(n1 + n2) <= abs(n1):
        c += 1
    ans = 2 * c
    if abs(n1) % (abs(n1 + n2)) != 0:
        ans += 1
    print(ans)

import sys

t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
n1 = (b1 - a1) * t1
n2 = (b2 - a2) * t2
if n1 * n2 > 0 or abs(n1) > abs(n2):
    print((0))
    sys.exit()
if abs(n1) == abs(n2):
    print("infinity")
    sys.exit()
c = abs(n1) // abs(n1 + n2)
while (c + 1) * abs(n1 + n2) <= abs(n1):
    c += 1
ans = 2 * c
if abs(n1) % (abs(n1 + n2)) != 0:
    ans += 1
print(ans)

+import sys + -elif abs(n1) == abs(n2): +    sys.exit() +if abs(n1) == abs(n2): -else: -    c = abs(n1) // abs(n1 + n2) -    while (c + 1) * abs(n1 + n2) <= abs(n1): -        c += 1 -    ans = 2 * c -    if abs(n1) % (abs(n1 + n2)) != 0: -        ans += 1 -    print(ans) +    sys.exit() +c = abs(n1) // abs(n1 + n2) +while (c + 1) * abs(n1 + n2) <= abs(n1): +    c += 1 +ans = 2 * c +if abs(n1) % (abs(n1 + n2)) != 0: +    ans += 1 +print(ans)