$t1, $t2 = gets.chomp.split.map(&:to_i)
$a1, $a2 = gets.chomp.split.map(&:to_i)
$b1, $b2 = gets.chomp.split.map(&:to_i)

if $a1*$t1 + $a2*$t2 == $b1*$t1 + $b2*$t2
    puts "infinity"
    exit 0
end

def f(t)
    c = t / 2
    if t % 2 == 0
        a = $a1 * $t1 * c + $a2 * $t2 * c
        b = $b1 * $t1 * c + $b2 * $t2 * c
        aa = a + $a1 * $t1
        bb = b + $b1 * $t1
        return false if a == b
        if a < b
            return aa >= bb
        else
            return aa <= bb
        end
    else
        a = $a1 * $t1 * (c+1) + $a2 * $t2 * c
        b = $b1 * $t1 * (c+1) + $b2 * $t2 * c
        aa = a + $a2 * $t2
        bb = b + $b2 * $t2
        return false if a == b
        if a < b
            return aa >= bb
        else
            return aa <= bb
        end
    end
end

if not f(1)
    puts "0"
    exit 0
end

ok = 1
ng = 1<<40

while ok+1 < ng
    x = (ok + ng) / 2
    if f(x)
        ok = x
    else
        ng = x
    end
end

puts ok