#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 200002
#define LL long long
using namespace std;
LL a,b,c,d,t1,t2;
int main()
{
    cin>>t1>>t2>>a>>b>>c>>d;
    
    LL A=(a-c)*t1;
    LL B=A+(b-d)*t2;
    
    if(B==0)
    {
        printf("infinity\n");
    }
    else if((B>0&&A>0)||(B<0&&A<0))
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<-(A/B)*2+(A%B!=0)<<endl;
    }
    
    return 0;
}
