import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!long);
    auto t1 = s[0];
    auto t2 = s[1];
    s = readln.split.map!(to!long);
    auto a = s[0];
    auto b = s[1];
    s = readln.split.map!(to!long);
    auto c = s[0];
    auto d = s[1];

    auto v = a * t1;
    auto w = b * t2;
    auto x = c * t1;
    auto y = d * t2;

    if (v > x && v + w > x + y) {
        writeln(0);
        return;
    }
    if (x > v && x + y > v + w) {
        writeln(0);
        return;
    }
    if (x + y == v + w) {
        writeln("infinity");
        return;
    }

    if (v > x) {
        swap(v, x);
        swap(w, y);
    }

    long diff1 = x - v;
    long diff2 = v + w - x - y;

    auto hi = BigInt(10L^^18);
    auto lo = BigInt(-1);

    while (hi - lo > 1) {
        auto mid = (hi + lo) / 2;
        auto p1 = (v + w) * mid;
        auto p2 = (x + y) * mid;
        if (p1 + v > p2 + x) {
            hi = mid;
        } else {
            lo = mid;
        }
    }

    (hi * 2 - 1).writeln;
}