import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val T1, T2 = in.next().toLong
  val A1, A2 = in.next().toLong
  val B1, B2 = in.next().toLong


  //
  val a1 = A1 * T1
  val a2 = A2 * T2

  val b1 = B1 * T1
  val b2 = B2 * T2

  val asum = a1 + a2
  val bsum = b1 + b2

  if (asum == bsum) {
    println("infinity")
  }
  else if (a1 > b1 == a2 > b2) {
    println(0)
  }
  else {
    val c1 = (a1 - b1).abs
    val c2 = (a2 - b2).abs

    val c3 = (c1 - c2).abs

    if (c1 > c2)
      println(0)
    else {
      var ans = (c1 / c3) * 2

      if (c1 % c3 != 0)
        ans += 1

      println(ans)
    }
  }
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.deep))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

