#include using namespace std; int main(){ int M,N,temp; cin>>M>>N; long long ans=0; while(N>0){ ans+=M/N+1; temp=M%N; M=N; N=temp; } cout<