#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c = 0, d = 0, e, f;
  cin >> a >> b;
  while (a > 0 && b > 0) {
    c = a / b;
    d = d + c;
    c = (c * b);
    a = a - c;
    if (a < b) {
      long long int temp;
      temp = a;
      a = b;
      b = temp;
    }
  }
  cout << d << endl;
  return 0;
}
