#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int c = 0;
  while (a != b) {
    if (a > b) {
      c += a / b;
      if (a % b == 0) break;
      a = a % b;
    } else {
      c += b / a;
      if (b % a == 0) break;
      b = b % a;
    }
  }
  cout << c;
  return 0;
}
