#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(ll i=0;i> N; ll ans=0; bool f=false; while(1){ if(N%2==0) N/=2; else N=3*N+1; ans++; if(N==1){ f=true; break; } } if(f) cout << ans << endl; else cout << "infinity" << endl; return 0; }