S=input() ans=False pos=-1 for i in range(len(S)): if S[i]=='.': pos=i ans=True break if ans==False: N=int(S) if N==1: print(1) else: print(2) exit() y=S[pos+1:] y=y+'0'*(100-len(y)) while y[0]=='0': y=y[1:] count=2 if pos==1 and S[0]=='0': count=0 z=10**100 y=int(y) while True: count+=1 if z%y==0: print(count) exit() y,z=z-y,y if count>=10**3: print('infty') exit()