#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int i = a / b;
  a = a % b;
  long long int n = min(a, b);
  long long int m = max(a, b);
  while (n != m && m > 0 && n > 0) {
    long long int c = n;
    n = min(n, m);
    m = max(c, m);
    i += m / n;
    m = m % n;
  }
  cout << i;
}
