import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int m = in.nextInt(), n = in.nextInt(); long s = 0; while (m != n) { if (m > n) { s += m/n; m %= n; if (m == 0) { s--; break; } } else { int t = m; m = n; n = t; s++; } } System.out.println(s); in.close(); } }