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:] z=10**100 y=int(y) if z%y==0: if pos==1 and S[0]=='0': print(1) else: print(3) exit() y,z=z-y,y if z%y==0: if pos==1 and s[0]=='0': print(2) else: print(4) exit() print('infty')