import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val t = in.readLine().split("\\s+").map(_.toLong)
    val a = in.readLine().split("\\s+").map(_.toLong)
    val b = in.readLine().split("\\s+").map(_.toLong)

    val ta0 = t(0) * a(0)
    val ta1 = t(1) * a(1)
    val tb0 = t(0) * b(0)
    val tb1 = t(1) * b(1)

    System.out.println(
      if (ta0 > tb0) {
        solve(ta0, ta1, tb0, tb1)
      } else {
        solve(tb0, tb1, ta0, ta1)
      }
    )
  }

  def solve(ta0: Long, ta1: Long, tb0: Long, tb1: Long): String = {
    if (ta0 + ta1 > tb0 + tb1) {
      "0"
    } else if (ta0 + ta1 == tb0 + tb1) {
      "infinity"
    } else {
      val initial = ta0 - tb0
      val diff = (ta0 - tb0) + (ta1 - tb1)
      val times = initial / -diff
      val just = initial % -diff == 0

      (
        times * 2 + (if (just) 0 else 1)
        ).toString
    }
  }
}
