X=float(input()) a=0 while X:a,X=a+1,1/X-int(1/X) print(a)