include iostream>
using namespace std;
int s(int a,int b){
if(a==b){
return 1;
}
if(a>b){
swap(a,b);
}
return s(a,b-a)+1;
}
int main(){
int a,b;
cin>>a>>b;
cout<<s(a,b);
return 0;
}
using namespace std;
int s(int a,int b){
if(a==b){
return 1;
}
if(a>b){
swap(a,b);
}
return s(a,b-a)+1;
}
int main(){
int a,b;
cin>>a>>b;
cout<<s(a,b);
return 0;
}