#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

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

    if(T1*A1+T2*A2 == T1*B1+T2*B2){
        cout << "infinity" << endl;
        return 0;
    }

    int fa;
    if(T1*A1+T2*A2 > T1*B1+T2*B2){
        fa = 1;
    }else{
        fa = 2;
    }


    if(fa==1){
        //dump("on")
        if(A1 > B1){
            cout << 0 << endl;
            return 0;
        }else{
            LL X = abs(B1-A1) * T1;
            LL Y = abs(T1*A1+T2*A2 - (T1*B1+T2*B2));
            //LL Y = abs(B2-A2) * T2;
            dump(X)
            dump(Y)

            //cout << (X +(abs(Y-X)-1))/ abs(Y-X) * 2 << endl;
            LL ans;
            if(X%Y != 0){
                ans = X/Y * 2;
                ans++;
            }else{
                ans = X/Y * 2;
            }
            cout << ans << endl;

            //if(X%Y != 0){

            //    cout << X / abs(Y-X) * 2 + 1 << endl;
            //}else{
            //    cout << X / abs(Y-X) * 2 << endl;
            //}
        }
    }else{
        //dump("of")
        if(B1 > A1){
            cout << 0 << endl;
            return 0;
        }else{
            LL X = abs(B1-A1) * T1;
            LL Y = abs(T1*A1+T2*A2 - (T1*B1+T2*B2));
            //LL Y = abs(B2-A2) * T2;

            dump(X)
            dump(Y)
            LL ans;
            if(X%Y != 0){
                ans = X/Y * 2;
                ans++;
            }else{
                ans = X/Y * 2;
            }
            cout << ans << endl;




            //cout << (X+(abs(Y-X)-1)) / abs(Y-X) * 2 << endl;
            //if(X%Y != 0){
            //    cout << X /Y * 2 + 1 << endl;
            //}else{
            //    cout << X / Y * 2 << endl;
            //}

       }

    }

}


Measured memory_bytes: 256