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