#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans=0,t1,t2,a,b,c,d;
int main(){
    scanf("%lld %lld %lld %lld %lld %lld",&t1,&t2,&a,&b,&c,&d);
    a-=c; b-=d; a*=t1; b*=t2;
    if(a+b==0) printf("infinity\n");
    else if(a>0&&a+b>0) printf("0\n");
    else if(a<0&&a+b<0) printf("0\n");
    else{
        b=fabs(b+a); a=fabs(a);
        ans=a/b*2;
        if(a%b!=0) ans++;
        printf("%lld\n",ans);
    }
}
