#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

ll T1, T2, A1, A2, B1, B2;

int main() {
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
	A1 -= B1;
	A2 -= B2;
	if (A1*T1 + A2*T2 == 0) {
		cout << "infinity" << endl;
		return 0;
	}
	if (A1*T1 + A2*T2 > 0) {
		A1 = -A1;
		A2 = -A2;
	}
	if (A1*T1 < 0) {
		cout << 0 << endl;
		return 0;
	}
	ll X = A1*T1;
	ll Y = -(A1*T1 + A2*T2);
	if (X%Y == 0) {
		cout << X / Y * 2 << endl;
	}
	else {
		cout << X / Y * 2 + 1 << endl;
	}
}