#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  long long a, b;
  long long t = 0;
  long long sum = 0;
  cin >> a >> b;
  while (b != 0) {
    sum += a / b;
    t = b;
    b = a % b;
    a = t;
  }
  cout << sum << endl;
  return 0;
}
