#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, n, p, count = 0;
  cin >> m >> n;
  if (m % n == 0)
    cout << m / n;
  else {
    count = count + (m / n);
    m = m % n;
    for (;;) {
      if (m > n) {
        if (m % n == 0) {
          count += m / n;
          break;
        }
        m = m - n;
        count++;
      } else if (n > m) {
        if (n % m == 0) {
          count += n / m;
          break;
        }
        n = n - m;
        count++;
      }
    }
    cout << count;
  }
  return 0;
}
