import std.stdio; import std.string; import std.conv; import std.algorithm; /// magic =============================== int magic(int m, int n, int acc=0){ if(!m || !n) return acc - 1; if(m < n) return magic(n , m, acc + 1); else return magic(m%n, n, acc + m/n); } /// main ================= void main(){ auto buf = readln.strip.split(" ").map!(to!int); magic(buf[0], buf[1]).writeln; }