#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int count = 0, a, b, temp = 1;
  cin >> a >> b;
  while (temp != 0) {
    count += a / b;
    temp = a % b;
    a = b;
    b = temp;
  }
  cout << count;
}
