#magic M,N=(int(i) for i in input().split()) c=0 if N>M: t=M M=N N=t c+=1 while N>0: t=N c+=M//N N=M%N M=t print(c)