#include #include using namespace std; unsigned long long ct = 0; void cut(unsigned long long a,unsigned long long b) { if(a == 1 && b == 1) return ; if(a == b) ct = ct + (a*b-1); else if(a > b) { cut(b,b); cut(a-b,b); ct++; }else if(b > a) { cut(a,a); cut(a,b-a); ct++; } } int main() { unsigned long long n,m; cin>>n>>m; cut(n,m); cout<