from decimal import Decimal,getcontext getcontext().prec=100 X=Decimal(input()) Y=set() ans=0 while X not in Y and X>10**-50: Y.add(X) ans+=1 X=pow(X,-1) X%=1 if X in Y: print("infy") else: print(ans)