
#include <iostream>


using namespace std;


int  T1, T2;
long long  A1, A2, B1, B2;



int main()
{

	cin >> T1;
	cin >> T2;
	cin >> A1;
	cin >> A2;
	cin >> B1;
	cin >> B2;


	long long C1 = A1 - B1;
	long long C2 = A2 - B2;

	long long tx = C1 * T1;
	long long bx = tx + C2 * T2;

	if (bx == 0) {
		cout << "infinity" << endl;
		return 0;
	}

	if ( !((tx > 0) ^ (bx > 0))) {
		cout << 0 << endl;
		return 0;
	}

	long long int ans = ((-tx) / bx) * 2 + 1;
  
	if ((-tx) % bx == 0) { ans--; }

	cout << ans << endl;

	return 0;


}