#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, cnt, rem, div;
  while (scanf("%lld %lld", &a, &b) == 2) {
    cnt = 0;
    while (b != 0) {
      rem = a % b;
      div = a / b;
      cnt += div;
      a = b;
      b = rem;
    }
    printf("%lld\n", cnt);
  }
  return 0;
}
