t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=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)
d9e17c7857e8d3430bdbc308cc8a294cb320d5ec
<mask token>

<mask token>
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)

t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = 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)

t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=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)